请问:怎样把下面的json的{}改成[]?

{"imgLists":{"imgUrl":"images\/3440.jpg","teacherId":"lh","teacherName":"teacher1"},{"imgUrl":"images\/3440.jpg","teacherId":"wjh","teacherName":"teacher2"},{"imgUrl":"images\/3440.jpg","teacherId":"mcl","teacherName":"teacher3"},{"imgUrl":"images\/3440.jpg","teacherId":"tls","teacherName":"teacher4"
},
{"imgUrl":"images\/3440.jpg","teacherId":"zed","teacherName":"teacher5"}}
怎样把上面的格式转成下面的:{"imgLists":[{"imgUrl":"images\/3440.jpg","teacherId":"lh","teacherName":"teacher1"},{"imgUrl":"images\/3440.jpg","teacherId":"wjh","teacherName":"teacher2"},{"imgUrl":"images\/3440.jpg","teacherId":"mcl","teacherName":"teacher3"},{"imgUrl":"images\/3440.jpg","teacherId":"tls","teacherName":"teacher4"
},
{"imgUrl":"images\/3440.jpg","teacherId":"zed","teacherName":"teacher5"}]}

第1个回答  2015-04-23
第一个不是json格式,第二个才是,建议第一个用字符串解析出数据后放到JSON对象里,然后JSON的tostring方法变成第二个字符串
相似回答