开发者

Parse a JSON Object

开发者 https://www.devze.com 2023-03-26 07:55 出处:网络
I have a JSON object like the following: { \"a\" : \"test\", \"b\" : \"test\", \"c\" : [{\"d\": \"test data\", \"f\": [\'e\',\'f\',\'g\']},

I have a JSON object like the following:

{
 "a" : "test", 
 "b" : "test", 
 "c" : [{"d": "test data", "f": ['e','f','g']}, 
      开发者_开发百科  {"f": "test data", "f": ['e','f','g']}
       ], 
  "d" : [{"g": "test data", "f": ['e','f','g']}, 
         {"h": "test data", "f": ['e','f','g']}
        ]  
}

I need to parse this and display it in a tree format. Could somebody show some direction please. I am working on ruby.


For a JSON parser, look at JSON.org

Listed there:

  • json
  • yajl-ruby
  • json-stream
0

精彩评论

暂无评论...
验证码 换一张
取 消