FreeMarker怎样解析JSON的啊。。。
@opal 你好,想跟你请教个问题:FreeMarker怎样解析JSON的啊。。。
比如下面这种,或者更复杂的
{"res":"0","msg":"OK","count":"3","pagenum":"1","pagesize":"1","totalpage":"1","userlist":[{"id":"1","name":"aa","sex":"男","age":"22"},{"id":"2","name":"bb","sex":"男","age":"21"},{"id":"3","name":"cc","sex":"女","age":"20"}]}
我的邮箱:xhdyw1225@126.com
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
如何处理返回值的json,请各位大神指教
大神阿。收藏了
。。。非常感谢大神的帮助
${json.res}
要学会变通啊
小弟初学这玩意,不是很明白
再请教下"res"那些又是怎么解析的呢。
<#assign text>
{"res":"0","msg":"OK","count":"3","pagenum":"1","pagesize":"1","totalpage":"1","userlist":[{"id":"1","name":"aa","sex":"男","age":"22"},{"id":"2","name":"bb","sex":"男","age":"21"},{"id":"3","name":"cc","sex":"女","age":"20"}]}
</#assign>
<#assign json=text?eval />
<#list json.userlist as item>
id:${item.id}, name:${item.name},sex:${item.sex}
</#list>