Skip to content

Instantly share code, notes, and snippets.

@talentdeficit
Created August 13, 2010 04:42
Show Gist options
  • Save talentdeficit/522302 to your computer and use it in GitHub Desktop.
Save talentdeficit/522302 to your computer and use it in GitHub Desktop.
-module(jsx_ex).
-export([simple_decode/1]).
simple_decode(JSON) when is_binary(JSON) ->
P = jsx:parser(),
decode(P(JSON), []).
decode({event, end_json, _Next}, Acc) ->
lists:reverse(Acc);
decode({event, Event, Next}, Acc) ->
decode(Next(), [Event] ++ Acc).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment