simple json lib for java

有时候为了需要将一个对象或数组转成json string 给前台需要用开json util 类,为了这个类我们又必须加入一大堆的其他类(jdk1.3),其实可以用simple json这个类库:

 

Featured downloads:
json_simple-1.1-all.zip

json_simple-1.1.jar

Overview

JSON.simple is a simple Java toolkit for JSON. You can use JSON.simple to encode or decode JSON text.

Features

  • Provides multiple functionalities such as encode, decode/parse and escape JSON text while keeping the library lightweight
  • Flexible, simple and easy to use by reusing Map and List interfaces
  • Supports streaming output of JSON text
  • Stoppable SAX-like interface for streaming input of JSON text (learn more )
  • Heap based parser
  • No dependency on external libraries
  • Both of the source code and the binary are JDK1.2 compatible

Getting Started

Note: You need to put the latest json_simple-1.1.jar in your CLASSPATH before compiling and running the example codes.

Mapping Between JSON and Java Entities

JSON Java
string java.lang.String
number java.lang.Number
true|false java.lang.Boolean
null null
array java.util.List
object java.util.Map

JSON.simple maps entities from the left side to the right side while decoding or parsing, and maps entities from the right to the left while encoding. While decoding, default concrete class of java.util.List is org.json.simple.JSONArray and default concrete class of java.util.Map is org.json.simple.JSONObject. While encoding, other classes that are not listed on the right side of the table need to implement JSONAware or JSONStreamAware (streaming only) to customize JSON outputs. In such cases, JSON.simple calls JSONAware.toJSONString() or JSONStreamAware.writeJSONString() to determine the resulting JSON text.

Developer's Guide

JSON.simple in Projects

JSON.simple in Publications

Next Steps

  • Auto marshalling and unmarshalling utils for Java Beans

Links

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值