[erlang-questions] javascript . notation to fetch objects from JSON decode_string/1

Bharani bharani_vms@REDACTED
Wed Aug 13 14:27:02 CEST 2008


Hi,

I am relatively new to Erlang and i have been playing with ejson for a
while. Right now to access nested objects i am using a function like

json_find(Json,[]) -> Json;
json_find(Json,[H|T])-> {ok,JsonNew}=json:obj_find(H,Json),find(JsonNew,T).

get(Json,Key)->
json_find(Json,string:tokens(Key,"."))
.

so that i can simple say get(<json string>,"obj1.obj2.field")

is this right way to do or can any one point out best practices

Thanks
Bharani
-- 
View this message in context: http://www.nabble.com/javascript-.-notation-to-fetch-objects-from-JSON-decode_string-1-tp18962077p18962077.html
Sent from the Erlang Questions mailing list archive at Nabble.com.




More information about the erlang-questions mailing list