开发者

How to traverse JsonObject?

I need to apply some function to all elements of JSON object. I guess it is named as Visitor or something like that. However JSON object (org.json.开发者_如何学CJsonObject or net.sf.json.JsonObject) are defined a bit cryptic, so if some one can point on a resource explaining how.


Assuming that you are using Java, you can look at the Javadoc to figure out how to use the JSON parser: http://json.org/javadoc/org/json/JSONObject.html

I am assuming that you need to read each element in the object. Look at the following functions: getNames (this returns all keys) and getString (returns a string of the value corresponding to a particular key).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜