Added some more parsing rules

This commit is contained in:
Jonatan Pålsson 2011-01-30 18:48:02 +01:00
parent dcab797d0f
commit 1f3f7daa9a

View file

@ -6,10 +6,17 @@
parse(JSONData) -> parse(JSONData) ->
{struct, Struct} = js_mochijson2:decode(JSONData), {struct, Struct} = js_mochijson2:decode(JSONData),
RequestType = proplists:get_value(<<"request">>, Struct), io:format("~p~n", [Struct]),
[{RequestType, Rest}] = Struct,%proplists:get_value(<<"request">>, Struct),
case RequestType of case RequestType of
<<"define">> -> <<"define">> ->
%Name = proplists:get_value(<<"name">>, Rest),
%{struct, Name} = proplists:get_value(<<"name">>, Rest),
{struct, Rest2} = Rest,
io:format("~p", [Rest2]),
ok_you_said_define; ok_you_said_define;
<<"call">> ->
ok_you_said_call;
Other -> Other ->
io:format("~p", [RequestType]), io:format("~p", [RequestType]),
ok_i_dont_understand ok_i_dont_understand