updated examples for new api

This commit is contained in:
alisdair sullivan 2010-06-09 00:58:23 -07:00
parent f042908c30
commit 38aef5f383
4 changed files with 4 additions and 4 deletions

View file

@ -34,7 +34,7 @@
%% also is not streaming, though it could be modified to parse partial objects/lists. %% also is not streaming, though it could be modified to parse partial objects/lists.
decode(JSON) -> decode(JSON) ->
P = jsx:decoder({jsx_parser, event, []}, []), P = jsx:parser({jsx_parser, event, []}, []),
case P(JSON) of case P(JSON) of
{incomplete, _} -> {incomplete, _} ->
{error, badjson} {error, badjson}

View file

@ -34,7 +34,7 @@
pretty(JSON, Opts) -> pretty(JSON, Opts) ->
Init = init(parse_opts(Opts, #opts{})), Init = init(parse_opts(Opts, #opts{})),
P = jsx:decoder({jsx_prettify, prettify, Init}, []), P = jsx:parser({jsx_prettify, prettify, Init}, []),
case P(JSON) of case P(JSON) of
{incomplete, _} -> {error, badjson} {incomplete, _} -> {error, badjson}
; {error, badjson} -> {error, badjson} ; {error, badjson} -> {error, badjson}

View file

@ -27,7 +27,7 @@
-export([decoder/1, event/2]). -export([decoder/1, event/2]).
decoder(Opts) -> decoder(Opts) ->
Decoder = jsx:decoder({jsx_stream_parser, event, 0}, Opts), Decoder = jsx:parser({jsx_stream_parser, event, 0}, Opts),
fun(Stream) -> try fun(Stream) -> try
case Decoder(Stream) of case Decoder(Stream) of
{incomplete, F} -> {incomplete, F} {incomplete, F} -> {incomplete, F}

View file

@ -32,7 +32,7 @@
%% also is not streaming, though it could be modified to parse partial objects/lists. %% also is not streaming, though it could be modified to parse partial objects/lists.
is_json(JSON) -> is_json(JSON) ->
P = jsx:decoder({jsx_verify, event, ok}, []), P = jsx:parser({jsx_verify, event, ok}, []),
case P(JSON) of case P(JSON) of
{incomplete, _} -> {incomplete, _} ->
false false