package json; import net.sf.json.JSONObject; public class Json { /** * @param args main(String[] args) { * 读取多重Json.... * */ String jsonStr = "{states:{rect1:{type:''start'',text:{text:''开始''}, " + "attr:{ x:448, y:105, width:50, height:50}, " + "props:{text:{value:''开始''},temp1:{value:''''}," + "temp2:{value:''''}}},rect2:{type:''state'',text:{text:''camel_element''}, " + "attr:{ x:431, y:224, width:100, height:50}, props:{text:{value:''camel_element''}," + "temp1:{value:''http://www/baidu.com''}}},rect3:{type:''end'',text:{text:''结束''}, " + "attr:{ x:454, y:365, width:50, height:50}, props:{text:{value:''结束''}," + "temp1:{value:''''},temp2:{value:''''}}}},paths:{path4:{from:''rect1'',to:''rect2'', dots:[]," + "text:{text:''TO camel_element''},textPos:{x:0,y:-10}, props:{text:{value:''''}}}," + "path5:{from:''rect2'',to:''rect3'', dots:[],text:{text:''TO 结束''},textPos:{x:0,y:-10}, " + "props:{text:{value:''''}}}},props:{props:{name:{value:''新建流程''},key:{value:''''}," + "desc:{value:''''}}}}"; JSONObject jsonObj = JSONObject.fromObject(jsonStr); System.out.println(jsonObj.getJSONObject("states").getJSONObject("rect1")); } }
这里其实就是给大家一个思路而已,具体的情况还是需要我们具体进行思考...只要思考,没有解决不了的问题....
Author By: Darker
声明:本文整理自互联网,不代表本站观点,如有异议请联系博主删除。
原文地址:#3339458