Automatically generate Java class definitions to use with Gson.fromJson

864 views
Skip to first unread message

Thura Hlaing

unread,
Sep 10, 2013, 6:34:43 AM9/10/13
to googl...@googlegroups.com
Hello guys,

I wrote a ruby script to generate java class definitions from json, to use with Gson.fromJson function.
https://github.com/trhura/json2java

Features
* can handle nested inner objects
* De-serialize snake_case names to Java's camelCase convention

I haven't tested it throughly though. Thought I might share this here, since it might be useful for somebody out there.

David Kirui

unread,
Feb 13, 2014, 5:00:21 AM2/13/14
to googl...@googlegroups.com
Good stuff.
Also check out this http://www.jsonschema2pojo.org/ 

Inderjeet Singh

unread,
Feb 13, 2014, 1:14:55 PM2/13/14
to googl...@googlegroups.com
Nice! Would be great if placing the serialized name was an optional thing. Note that you can use FieldNamingPolicy.
LOWER_CASE_WITH_UNDERSCORES to get the same effect.

Best
Inder


On Tuesday, September 10, 2013 3:34:43 AM UTC-7, Thura Hlaing wrote:
Reply all
Reply to author
Forward
0 new messages