简体   繁体   中英

Serializing / Deserializing Json to different structure using gson?

I would like to have different object structure created from json.

For example I would like to create json with inner object but when I deserialize it should be assigned to a field.

Example json :

{
 "id": 1,
 "innerData": {
    "a": "foo",
    "b": "bar"
 }
}

I would like to deserialize it to object with two fields - int id and String b

我最后写了自定义解串器。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM