扬帆大鱼
Map map = new HashMap();map.put( "name", "json" );map.put( "bool", Boolean.TRUE );map.put( "int", new Integer(1) );map.put( "array", new String[]{"a","b"} );map.put( "func", "function(i){ return this.arr[i]; }" );JSONObject jsonObject = JSONObject.fromObject( map );try {List<Object> arr = jsonObject.names();//获取名Collection<Object> arra = jsonObject.values();//获取值for(Object name:arr){System.out.println(name.toString());}for(Object value:arra){System.out.println(value.toString());}} catch (Exception e) {e.printStackTrace();}