Core LibraryunreleasedAPI Reference

Choose documentation 1

latest

Current version

latest
English

Unreleased libtmux_erlang has not been released. Its API may change during development. This site's structure and URLs may change too.

Erlang API

function libtmux-erlang latest

tmux_json:decode/1

Return a decoded value or a structured error without creating payload atoms.

Source and package
Qualified name
tmux_json:decode/1
Declared in
tmux_json
Package
libtmux_erlang
Source
apps/libtmux_erlang/src/tmux_json.erl
decode/1 -spec decode(binary()) -> {ok, json:decode_value()} | {error, map()}.

Examples#

1> tmux_json:decode(<<"{\"a\": [1, true, null]}">>).
{ok,#{<<"a">> => [1,true,null]}}
2> tmux_json:decode(<<"{\"a\": {\"x\": 1, \"x\": 2}}">>).
{error,#{code => duplicate_key,path => [<<"a">>,<<"x">>]}}
3> tmux_json:decode(<<"[] []">>).
{error,#{code => trailing_input,path => []}}
Parameters
Esc

Type to search.

Reference previewOpen reference