jsp前端页面如何解析json数据?
如题,现有一jsp页面,需要解析并显示后台传过来的json数据,json数据如下:{"button":[{"name":"课程服务","sub_button":[{"na...
如题,现有一jsp页面,需要解析并显示后台传过来的json数据,json数据如下:
{"button":[{"name":"课程服务","sub_button":[{"name":"课程一","type":"view","url":"http://www.baidu.com","sub_button":[]},{"name":"课程二","type":"click","url":"ccc","sub_button":[]},{"name":"课程三","type":"view","url":"http://www.baidu.com","sub_button":[]},{"name":"课程四","type":"view","url":"http://www.qq.com","sub_button":[]},{"name":"课程五","type":"click","url":"eee","sub_button":[]}]},{"name":"活动信息","sub_button":[{"name":"活动一","type":"click","url":"aaa","sub_button":[]},{"name":"活动二","type":"view","url":"http://www.baidu.com","sub_button":[]},{"name":"活动三","type":"view","url":"http://www.baidu.com","sub_button":[]},{"name":"活动四","type":"view","url":"http://www.qq.com","sub_button":[]},{"name":"活动五","type":"click","url":"fff","sub_button":[]}]},{"name":"项目信息","sub_button":[{"name":"项目一","type":"click","url":"bbb","sub_button":[]},{"name":"项目二","type":"click","url":"ddd","sub_button":[]},{"name":"项目三","type":"view","url":"http://www.baidu.com","sub_button":[]},{"name":"项目四","type":"view","key":"course","sub_button":[]},{"name":"项目五","type":"click","key":"ggg","sub_button":[]}]}]}
页面显示格式如下图:
请问如何达到这种效果,结果正确可再加20分。
json字符串可以使用js,jquery,ajax,java这几种技术,页面为jsp页面,json数据为java后台传递来。 展开
{"button":[{"name":"课程服务","sub_button":[{"name":"课程一","type":"view","url":"http://www.baidu.com","sub_button":[]},{"name":"课程二","type":"click","url":"ccc","sub_button":[]},{"name":"课程三","type":"view","url":"http://www.baidu.com","sub_button":[]},{"name":"课程四","type":"view","url":"http://www.qq.com","sub_button":[]},{"name":"课程五","type":"click","url":"eee","sub_button":[]}]},{"name":"活动信息","sub_button":[{"name":"活动一","type":"click","url":"aaa","sub_button":[]},{"name":"活动二","type":"view","url":"http://www.baidu.com","sub_button":[]},{"name":"活动三","type":"view","url":"http://www.baidu.com","sub_button":[]},{"name":"活动四","type":"view","url":"http://www.qq.com","sub_button":[]},{"name":"活动五","type":"click","url":"fff","sub_button":[]}]},{"name":"项目信息","sub_button":[{"name":"项目一","type":"click","url":"bbb","sub_button":[]},{"name":"项目二","type":"click","url":"ddd","sub_button":[]},{"name":"项目三","type":"view","url":"http://www.baidu.com","sub_button":[]},{"name":"项目四","type":"view","key":"course","sub_button":[]},{"name":"项目五","type":"click","key":"ggg","sub_button":[]}]}]}
页面显示格式如下图:
请问如何达到这种效果,结果正确可再加20分。
json字符串可以使用js,jquery,ajax,java这几种技术,页面为jsp页面,json数据为java后台传递来。 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询