Is there any way to mapping nested json object into single Java class? for example, I have this json string:
{
"order_id": 104,
"order_details" : [
{
"name": "Product#1",
"price": {
"usd": 12.95
}
}
]
}
I want to map with this class:
public class Order{
Int id; // rename
String name; //map with order_details.name
float price; //map with order_details.price.usd
}
*UPDATE: Sorry for unclear question. I am developer for both Objective-C and Java. When I work with JSONModel in ObjC, It's easy to config the mapping like this: https://github.com/icanzilb/JSONModel#key-mapping
I hate to parse JSON manually using getJSONObject()
, getString()
, ... I am finding a way to configure for automatically parsing with Gson
for Java.