多数组json 封装为java object

2018-04-02  本文已影响0人  白敏鸢
{"data": [
  {
        "id": 3,
        "name": "16系列",
        "children": [
            {
                "id": 4,
                "name": "男鞋红色",
                "children": null,
                "parentId": 3,
                "image": "http://xxx608.png",
                "banner": null,
                "type": "category",
                "first_char": null,
                "enabled": true
            },
            {
                "id": 15,
                "name": "男鞋绿色",
                "children": null,
                "parentId": 3,
                "image": "http://xxx114.png",
                "banner": null,
                "type": "category",
                "first_char": null,
                "enabled": true
            },],
        "parentId": 0,
        "image": "http://xxxxx885.png",
        "banner": "http://xxxx_m.jpg",
        "type": "category",
        "first_char": null,
        "enabled": true
    },
    {
        "id": 3,
        "name": "17系列",
        "children": [
            {
                "id": 3,
                "name": "男鞋粉色",
                "children": null,
                "parentId": 3,
                "image": "http://xxx608.png",
                "banner": null,
                "type": "category",
                "first_char": null,
                "enabled": true
            },
            {
                "id": 12,
                "name": "男鞋黑色",
                "children": null,
                "parentId": 3,
                "image": "http://xxx114.png",
                "banner": null,
                "type": "category",
                "first_char": null,
                "enabled": true
            },],
        "parentId": 0,
        "image": "http://xxxxx885.png",
        "banner": "http://xxxx_m.jpg",
        "type": "category",
        "first_char": null,
        "enabled": true
    }
  ],
"status": {
    "succeed": 1,
    "error_code": null,
    "error_desc": null
    },
"paginated": null,
"session": null
}

java bean中定义java类,(这里省略setter、getter方法,自己补上)


这里写图片描述 这里写图片描述

值得注意的地方是,这里MobileBigCategory对应json中的data数组,MobileSmallCategory对应data中的children数组,需要在MobileBigCategory中定义ArrayList

上一篇 下一篇

猜你喜欢

热点阅读