Fast, auto-generated streaming JSON parsing for Android
instagram-engineering.tumblr.com
instagram-engineering.tumblr.com
It looks kind of odd in your sample code too, it'd be nice if it could auto-try those fields, but I can see why that won't work if this is compile-time rather than at processing-time like GSON (it has no way of checking against the JSON to see if that assumption is true) -- maybe have `JsonType` take and optional parameter that enables "guess types" mode?
I'm one of the authors of this library. The code this library emits is very similar to the json/jackson/manual serializer/deserializer in https://github.com/eishay/jvm-serializers/wiki. Conveniently, GSON is benchmarked there too.
You're right, the field names could be guessed at compile time. Please feel free to submit a PR!
Thanks!
(Of course only for json generation from XML)
For some further abstraction/encapsulation, you can extend the JSONObject class and provide getters/settings for particular key/values.