News for hackers. Stuff that matters.
Re:Debunking the myths about parsing JSON in Swift by efaref on Thursday February 18, 2016 @11:45AM (#11127025)
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).

There are no comments on this comment yet.