这是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
}
]
}
帮你格式化一下代码:
{
"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
}
]
}
怎么实现??
@zhwh2723287217: 这个编辑器是支持markdown的
这不就是一段json数据嘛,把你从库里面的查出来的数据循环赋值输出就ok了啊
不让弄循环
@zhwh2723287217: 就是一个list集合转json 还有什么好的办法
构建实体类,然后用newtoon.Json转成实体类集合
请问现在是要组装这个数据吗?
这个json数据最后想要变成什么样子?
– hellotim 6年前