3 ms·
And here's your regularly scheduled announcement that the actual JSON parsing is done by the library call NSJSONSerialization.JSONObjectWithData(...) in line 3
by mpweiher 11y ago
And here's your regularly scheduled announcement that the actual JSON parsing is done by the library call NSJSONSerialization.JSONObjectWithData(...) in line 3 of the code.
The rest is just getting the parsed data out of already parsed nested dictionaries and arrays in a way that makes the type checker happy. Calling that "parsing" is probably the biggest myth of them all (though agreed about all the other myths).
- efaref 11y agoTrue. Although the Android JsonReader class does force you to write your own parser (it is itself merely a lexer). This is really inelegant. What I'd really like is a way to write my POD types as normal: class Foo { int bar; String baz; ArrayList<String> blah; ArrayList<Xyz> xyzs; } class Xyz { String name; int value; } And then just write this to parse it all. ... Parser<Foo> p = new Parser<Foo>(); Foo f; try { f = gp.parse(input); } catch (JsonParseException e) { ... } I'd be willing to accept having to annotate some of the fields, (but other than that, this should be possible to do).