Added some more parsing rules
This commit is contained in:
parent
dcab797d0f
commit
1f3f7daa9a
1 changed files with 8 additions and 1 deletions
|
@ -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
|
||||||
|
|
Reference in a new issue