开发者

How to traverse JsonObject?

开发者 https://www.devze.com 2023-03-25 05:50 出处:网络
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) a

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

精彩评论

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