updated examples to match new decoder api
This commit is contained in:
parent
41292d4077
commit
537ad61223
3 changed files with 42 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue