针对JSON的基于java和js多种操作方法与格式转换方法

来源:互联网 发布:贝叶斯分类 python 编辑:程序博客网 时间:2024/06/05 13:11
转自:http://blog.csdn.net/yethyeth/archive/2007/04/15/1565844.aspx 感谢作者!
针对JSON的基于java和js多种操作与格式转换方法
org.json包
http://www.json.org/java/index.html
<!--[if !supportLists]-->1.      <!--[endif]-->JSONObject,用一个HashMap来保存一个JSON对象的所有属性。
<!--[if !supportLists]-->2.      <!--[endif]-->JSONArray用ArrayList来保存数据。JSON来自javascript,javascript中Array也是Object,不知这里是如何保存这种关系的。
<!--[if !supportLists]-->3.      <!--[endif]-->一些跟字符串有关的类,以及异常类。
<!--[if !supportLists]-->4.      <!--[endif]-->一些工具类,比如xml和json转换的类,将http头和cookies转换为json的类,
 
 
基于org.json包的JSON-LIB:bean,map,collection,java array,xml与json间的转换。
http://json-lib.sourceforge.net/
http://json-lib.sourceforge.net/usage.html
 
Stringtree JSON:JSON与java对象间的转换
http://www.stringtree.org/stringtree-json.html
三个关键类:
  • JSONReader.java
  • JSONWriter.java
  • JSONValidator.java
JSONValidator用来检查JSON的有效性。
JSONReader将一个正确形式的JSON字符串转换为一个java对象。
JSONWriter将一个java对象转换为一个JSON字符串。
 
XSLTJSON:用xslt将xml转换为json
http://www.bramstein.nl/xsltjson/
 
JSONT:基于js和自定义规则,转换JSON为任意其他格式
http://goessner.net/articles/jsont/
 

 

原创粉丝点击