updated examples to match new decoder api

This commit is contained in:
alisdair sullivan 2010-05-25 21:05:37 -07:00
parent 41292d4077
commit 537ad61223
3 changed files with 42 additions and 2 deletions

View file

@ -1,6 +1,7 @@
-module(jsx_parser).
-export([decode/2, event/2]).
-export([literal/1, string/1, number/1]).
%% this is a strict parser, no comments, no naked values and only one key per object. it
@ -8,7 +9,7 @@
decode(JSON, Opts) ->
P = jsx:decoder({{jsx_parser, event}, []}, Opts),
{{_, Result}, Rest} = P(JSON),
{Result, Rest} = P(JSON),
case jsx:tail_clean(Rest) of
true -> Result
; _ -> exit(badarg)