Debunking the myths about parsing JSON in Swift
roadfiresoftware.com
roadfiresoftware.com
Noticed this might be an ad about a book... Parsing JSON in Swift. The bubble is real. What developer would buy this? What's next, a book about NSURLSession?
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).
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).I don't know why anyone would bother writing their own, though.
(IMA non-swift programmer)