# tmux_json:decode/1

- **Package:** libtmux_erlang
- **Language:** Erlang
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-erlang/blob/d1b6308440cf9eb8f6647e7ae434bce60e849368/apps/libtmux_erlang/src/tmux_json.erl#L32
- **Page:** https://libtmux.org/en/erlang/latest/reference/tmux_json-decode-1/

```
decode/1
-spec decode(binary()) ->
                {ok, json:decode_value()} | {error, map()}.
```

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

## Examples

```erlang
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

- `Binary` (`binary()`)
