replace all incidences of to_json and to_term with encode and decode

This commit is contained in:
alisdair sullivan 2012-05-24 08:34:52 -07:00
parent 227a786899
commit aa3c8acf03

View file

@ -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\"]">>
``` ```