JSON.simple 介绍
JSON.simple是一个简单的Java类库,用于解析和生成JSON文本。不依赖于其它类库,性能高。
示例代码:
System.out.println(“=======decode=======”);
String s=”[0,{"1":{"2":{"3":{"4":[5,{"6":7}]}}}}]”;
Object obj=JSONValue.parse(s);
JSONArray array=(JSONArray)obj;
System.out.println(“======the 2nd element of array======”);
System.out.println(array.get(1));
System.out.println();
JSONObject obj2=(JSONObject)array.get(1);
System.out.println(“======field "1"==========”);
System.out.println(obj2.get(“1”));
s=”{}”;
obj=JSONValue.parse(s);
System.out.println(obj);
s=”[5,]”;
obj=JSONValue.parse(s);
System.out.println(obj);
s=”[5,,2]”;
obj=JSONValue.parse(s);
System.out.println(obj);
JSON.simple 官网
http://code.google.com/p/json-simple/
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。