Arya
Arya

Reputation: 8995

Parsing data with Gson multiple classes

I used http://www.jsonschema2pojo.org/ to create Java bean classes from a JSON page which I am trying to parse and it generated 6 classes. Now I am stuck on how to tell GSON to map the data to those classes. Any help would be highly appreciated.

Upvotes: 0

Views: 388

Answers (1)

Thupten
Thupten

Reputation: 2218

Gson gson = new Gson();
Foo foo2 = (Foo)gson.fromJson(json, Foo.class);

Upvotes: 1

Related Questions