replace all incidences of to_json
and to_term
with encode
and decode
This commit is contained in:
parent
227a786899
commit
aa3c8acf03
1 changed files with 4 additions and 4 deletions
|
@ -41,18 +41,18 @@ tanga:jsx alisdair$ rebar eunit
|
||||||
to convert a utf8 binary containing a json string into an erlang term
|
to convert a utf8 binary containing a json string into an erlang term
|
||||||
|
|
||||||
```erlang
|
```erlang
|
||||||
1> jsx:to_term(<<"{\"library\": \"jsx\", \"awesome\": true}">>).
|
1> jsx:decode(<<"{\"library\": \"jsx\", \"awesome\": true}">>).
|
||||||
[{<<"library">>,<<"jsx">>},{<<"awesome">>,true}]
|
[{<<"library">>,<<"jsx">>},{<<"awesome">>,true}]
|
||||||
2> jsx:to_term(<<"[\"a\",\"list\",\"of\",\"words\"]">>).
|
2> jsx:decode(<<"[\"a\",\"list\",\"of\",\"words\"]">>).
|
||||||
[<<"a">>, <<"list">>, <<"of">>, <<"words">>]
|
[<<"a">>, <<"list">>, <<"of">>, <<"words">>]
|
||||||
```
|
```
|
||||||
|
|
||||||
to convert an erlang term into a utf8 binary containing a json string
|
to convert an erlang term into a utf8 binary containing a json string
|
||||||
|
|
||||||
```erlang
|
```erlang
|
||||||
1> jsx:to_json([{<<"library">>,<<"jsx">>},{<<"awesome">>,true}]).
|
1> jsx:encode([{<<"library">>,<<"jsx">>},{<<"awesome">>,true}]).
|
||||||
<<"{\"library\": \"jsx\", \"awesome\": true}">>
|
<<"{\"library\": \"jsx\", \"awesome\": true}">>
|
||||||
2> jsx:to_json([<<"a">>, <<"list">>, <<"of">>, <<"words">>]).
|
2> jsx:encode([<<"a">>, <<"list">>, <<"of">>, <<"words">>]).
|
||||||
<<"[\"a\",\"list\",\"of\",\"words\"]">>
|
<<"[\"a\",\"list\",\"of\",\"words\"]">>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue