美文网首页
多数组json 封装为java object

多数组json 封装为java object

作者: 白敏鸢 | 来源:发表于2018-04-02 11:30 被阅读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

相关文章

网友评论

      本文标题:多数组json 封装为java object

      本文链接:https://www.haomeiwen.com/subject/csbthftx.html