3 ms·
Not sure what you mean. What about https://github.com/douglascrockford/JSON-java https://github.com/douglascrockford/JSON-java ?
by hayksaakian 12y ago
Not sure what you mean. What about
https://github.com/douglascrockford/JSON-java https://github.com/douglascrockford/JSON-java ?
- twic 12y agoGiven the JSON string: {"cities": [{"name": "London"}, {"name": "New York"}]} Parsed into a variable called 'root' with either 'new JSONObject(...)' or 'json.loads(...)', compare: root.getJSONArray("cities").getJSONObject(0).getString("name"); To: root['cities'][0]['name'] The Python version is the sort of thing you find yourself writing in Python anyway (at least, if you write tabloid-level Python the way i do); it's reasonably idiomatic. The Java version is cumbersome and feels very un-Javaish. Bear in mind that with SOAP, in Java, by that point you would have mangled the data into realistic-looking objects, and would write something like: root.getCities().get(0).getName();