微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

JSON.simple

程序名称:JSON.simple

授权协议: Apache

操作系统: 跨平台

开发语言: Java

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/

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐