首页 新闻 会员 周边 捐助

数据封装成嵌套的json

0
[待解决问题]

这是json数据,需要按照stageId或者stageName进行json嵌套

{
"msg": "success",
"code": 0,
"gradeInfos": [
{
"gradeId": 1667,
"enabled": 1,
"name": "五年级",
"schoolLengthId": null,
"stageId": 219,
"createTime": null,
"createUserId": null,
"updateTime": null,
"updateUserId": null,
"schoolLengthName": "六年制",
"pubisherName": null,
"stageName": "小学",
"createUserName": null,
"updateUserName": null
},
{
"gradeId": 345,
"enabled": 1,
"name": "二年级",
"schoolLengthId": null,
"stageId": 219,
"createTime": null,
"createUserId": null,
"updateTime": null,
"updateUserId": null,
"schoolLengthName": "六年制",
"pubisherName": null,
"stageName": "小学",
"createUserName": null,
"updateUserName": null
},
{
"gradeId": 1665,
"enabled": 1,
"name": "四年级",
"schoolLengthId": null,
"stageId": 219,
"createTime": null,
"createUserId": null,
"updateTime": null,
"updateUserId": null,
"schoolLengthName": "六年制",
"pubisherName": null,
"stageName": "小学",
"createUserName": null,
"updateUserName": null
},
{
"gradeId": 221,
"enabled": 1,
"name": "一年级",
"schoolLengthId": null,
"stageId": 219,
"createTime": null,
"createUserId": null,
"updateTime": null,
"updateUserId": null,
"schoolLengthName": "六年制",
"pubisherName": null,
"stageName": "小学",
"createUserName": null,
"updateUserName": null
},
{
"gradeId": 1669,
"enabled": 1,
"name": "六年级",
"schoolLengthId": null,
"stageId": 219,
"createTime": null,
"createUserId": null,
"updateTime": null,
"updateUserId": null,
"schoolLengthName": "六年制",
"pubisherName": null,
"stageName": "小学",
"createUserName": null,
"updateUserName": null
},
{
"gradeId": 1663,
"enabled": 1,
"name": "三年级",
"schoolLengthId": null,
"stageId": 219,
"createTime": null,
"createUserId": null,
"updateTime": null,
"updateUserId": null,
"schoolLengthName": "六年制",
"pubisherName": null,
"stageName": "小学",
"createUserName": null,
"updateUserName": null
},
{
"gradeId": 322,
"enabled": 1,
"name": "八年级",
"schoolLengthId": null,
"stageId": 316,
"createTime": null,
"createUserId": null,
"updateTime": null,
"updateUserId": null,
"schoolLengthName": "三年制",
"pubisherName": null,
"stageName": "初中",
"createUserName": null,
"updateUserName": null
},
{
"gradeId": 320,
"enabled": 1,
"name": "七年级",
"schoolLengthId": null,
"stageId": 316,
"createTime": null,
"createUserId": null,
"updateTime": null,
"updateUserId": null,
"schoolLengthName": "三年制",
"pubisherName": null,
"stageName": "初中",
"createUserName": null,
"updateUserName": null
},
{
"gradeId": 324,
"enabled": 1,
"name": "九年级",
"schoolLengthId": null,
"stageId": 316,
"createTime": null,
"createUserId": null,
"updateTime": null,
"updateUserId": null,
"schoolLengthName": "三年制",
"pubisherName": null,
"stageName": "初中",
"createUserName": null,
"updateUserName": null
},
{
"gradeId": 4781,
"enabled": 1,
"name": "必修四",
"schoolLengthId": null,
"stageId": 970,
"createTime": null,
"createUserId": null,
"updateTime": null,
"updateUserId": null,
"schoolLengthName": "三年制",
"pubisherName": null,
"stageName": "高中",
"createUserName": null,
"updateUserName": null
},
{
"gradeId": 4767,
"enabled": 1,
"name": "必修二",
"schoolLengthId": null,
"stageId": 970,
"createTime": null,
"createUserId": null,
"updateTime": null,
"updateUserId": null,
"schoolLengthName": "三年制",
"pubisherName": null,
"stageName": "高中",
"createUserName": null,
"updateUserName": null
},
{
"gradeId": 4993,
"enabled": 1,
"name": "选修系列",
"schoolLengthId": null,
"stageId": 970,
"createTime": null,
"createUserId": null,
"updateTime": null,
"updateUserId": null,
"schoolLengthName": "三年制",
"pubisherName": null,
"stageName": "高中",
"createUserName": null,
"updateUserName": null
},
{
"gradeId": 4769,
"enabled": 1,
"name": "必修三",
"schoolLengthId": null,
"stageId": 970,
"createTime": null,
"createUserId": null,
"updateTime": null,
"updateUserId": null,
"schoolLengthName": "三年制",
"pubisherName": null,
"stageName": "高中",
"createUserName": null,
"updateUserName": null
},
{
"gradeId": 4783,
"enabled": 1,
"name": "必修五",
"schoolLengthId": null,
"stageId": 970,
"createTime": null,
"createUserId": null,
"updateTime": null,
"updateUserId": null,
"schoolLengthName": "三年制",
"pubisherName": null,
"stageName": "高中",
"createUserName": null,
"updateUserName": null
},
{
"gradeId": 974,
"enabled": 1,
"name": "必修一",
"schoolLengthId": null,
"stageId": 970,
"createTime": null,
"createUserId": null,
"updateTime": null,
"updateUserId": null,
"schoolLengthName": "三年制",
"pubisherName": null,
"stageName": "高中",
"createUserName": null,
"updateUserName": null
}
]
}

China_zhwh的主页 China_zhwh | 菜鸟二级 | 园豆:204
提问于:2018-10-25 14:36

这个json数据最后想要变成什么样子?

hellotim 6年前
< >
分享
所有回答(4)
0

帮你格式化一下代码:

{
    "msg": "success",
    "code": 0,
    "gradeInfos": [{
            "gradeId": 1667,
            "enabled": 1,
            "name": "五年级",
            "schoolLengthId": null,
            "stageId": 219,
            "createTime": null,
            "createUserId": null,
            "updateTime": null,
            "updateUserId": null,
            "schoolLengthName": "六年制",
            "pubisherName": null,
            "stageName": "小学",
            "createUserName": null,
            "updateUserName": null
        },
        {
            "gradeId": 345,
            "enabled": 1,
            "name": "二年级",
            "schoolLengthId": null,
            "stageId": 219,
            "createTime": null,
            "createUserId": null,
            "updateTime": null,
            "updateUserId": null,
            "schoolLengthName": "六年制",
            "pubisherName": null,
            "stageName": "小学",
            "createUserName": null,
            "updateUserName": null
        },
        {
            "gradeId": 1665,
            "enabled": 1,
            "name": "四年级",
            "schoolLengthId": null,
            "stageId": 219,
            "createTime": null,
            "createUserId": null,
            "updateTime": null,
            "updateUserId": null,
            "schoolLengthName": "六年制",
            "pubisherName": null,
            "stageName": "小学",
            "createUserName": null,
            "updateUserName": null
        },
        {
            "gradeId": 221,
            "enabled": 1,
            "name": "一年级",
            "schoolLengthId": null,
            "stageId": 219,
            "createTime": null,
            "createUserId": null,
            "updateTime": null,
            "updateUserId": null,
            "schoolLengthName": "六年制",
            "pubisherName": null,
            "stageName": "小学",
            "createUserName": null,
            "updateUserName": null
        },
        {
            "gradeId": 1669,
            "enabled": 1,
            "name": "六年级",
            "schoolLengthId": null,
            "stageId": 219,
            "createTime": null,
            "createUserId": null,
            "updateTime": null,
            "updateUserId": null,
            "schoolLengthName": "六年制",
            "pubisherName": null,
            "stageName": "小学",
            "createUserName": null,
            "updateUserName": null
        },
        {
            "gradeId": 1663,
            "enabled": 1,
            "name": "三年级",
            "schoolLengthId": null,
            "stageId": 219,
            "createTime": null,
            "createUserId": null,
            "updateTime": null,
            "updateUserId": null,
            "schoolLengthName": "六年制",
            "pubisherName": null,
            "stageName": "小学",
            "createUserName": null,
            "updateUserName": null
        },
        {
            "gradeId": 322,
            "enabled": 1,
            "name": "八年级",
            "schoolLengthId": null,
            "stageId": 316,
            "createTime": null,
            "createUserId": null,
            "updateTime": null,
            "updateUserId": null,
            "schoolLengthName": "三年制",
            "pubisherName": null,
            "stageName": "初中",
            "createUserName": null,
            "updateUserName": null
        },
        {
            "gradeId": 320,
            "enabled": 1,
            "name": "七年级",
            "schoolLengthId": null,
            "stageId": 316,
            "createTime": null,
            "createUserId": null,
            "updateTime": null,
            "updateUserId": null,
            "schoolLengthName": "三年制",
            "pubisherName": null,
            "stageName": "初中",
            "createUserName": null,
            "updateUserName": null
        },
        {
            "gradeId": 324,
            "enabled": 1,
            "name": "九年级",
            "schoolLengthId": null,
            "stageId": 316,
            "createTime": null,
            "createUserId": null,
            "updateTime": null,
            "updateUserId": null,
            "schoolLengthName": "三年制",
            "pubisherName": null,
            "stageName": "初中",
            "createUserName": null,
            "updateUserName": null
        },
        {
            "gradeId": 4781,
            "enabled": 1,
            "name": "必修四",
            "schoolLengthId": null,
            "stageId": 970,
            "createTime": null,
            "createUserId": null,
            "updateTime": null,
            "updateUserId": null,
            "schoolLengthName": "三年制",
            "pubisherName": null,
            "stageName": "高中",
            "createUserName": null,
            "updateUserName": null
        },
        {
            "gradeId": 4767,
            "enabled": 1,
            "name": "必修二",
            "schoolLengthId": null,
            "stageId": 970,
            "createTime": null,
            "createUserId": null,
            "updateTime": null,
            "updateUserId": null,
            "schoolLengthName": "三年制",
            "pubisherName": null,
            "stageName": "高中",
            "createUserName": null,
            "updateUserName": null
        },
        {
            "gradeId": 4993,
            "enabled": 1,
            "name": "选修系列",
            "schoolLengthId": null,
            "stageId": 970,
            "createTime": null,
            "createUserId": null,
            "updateTime": null,
            "updateUserId": null,
            "schoolLengthName": "三年制",
            "pubisherName": null,
            "stageName": "高中",
            "createUserName": null,
            "updateUserName": null
        },
        {
            "gradeId": 4769,
            "enabled": 1,
            "name": "必修三",
            "schoolLengthId": null,
            "stageId": 970,
            "createTime": null,
            "createUserId": null,
            "updateTime": null,
            "updateUserId": null,
            "schoolLengthName": "三年制",
            "pubisherName": null,
            "stageName": "高中",
            "createUserName": null,
            "updateUserName": null
        },
        {
            "gradeId": 4783,
            "enabled": 1,
            "name": "必修五",
            "schoolLengthId": null,
            "stageId": 970,
            "createTime": null,
            "createUserId": null,
            "updateTime": null,
            "updateUserId": null,
            "schoolLengthName": "三年制",
            "pubisherName": null,
            "stageName": "高中",
            "createUserName": null,
            "updateUserName": null
        },
        {
            "gradeId": 974,
            "enabled": 1,
            "name": "必修一",
            "schoolLengthId": null,
            "stageId": 970,
            "createTime": null,
            "createUserId": null,
            "updateTime": null,
            "updateUserId": null,
            "schoolLengthName": "三年制",
            "pubisherName": null,
            "stageName": "高中",
            "createUserName": null,
            "updateUserName": null
        }
    ]
}
会长 | 园豆:12463 (专家六级) | 2018-10-25 14:44

怎么实现??

支持(0) 反对(0) China_zhwh | 园豆:204 (菜鸟二级) | 2018-10-25 14:46

@zhwh2723287217: 这个编辑器是支持markdown的

支持(0) 反对(0) 会长 | 园豆:12463 (专家六级) | 2018-10-25 15:26
0

这不就是一段json数据嘛,把你从库里面的查出来的数据循环赋值输出就ok了啊

雷。 | 园豆:775 (小虾三级) | 2018-10-25 15:35

不让弄循环

支持(0) 反对(0) China_zhwh | 园豆:204 (菜鸟二级) | 2018-10-25 15:36

@zhwh2723287217: 就是一个list集合转json 还有什么好的办法

支持(0) 反对(0) 雷。 | 园豆:775 (小虾三级) | 2018-10-25 15:43
0

构建实体类,然后用newtoon.Json转成实体类集合

猝不及防 | 园豆:2878 (老鸟四级) | 2018-10-25 18:20
0

请问现在是要组装这个数据吗?

祁临芯 | 园豆:251 (菜鸟二级) | 2018-10-25 22:46
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册