4 ms·
True. 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
by efaref 11y ago
True. 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).