Skip to content
fangyidong edited this page Apr 26, 2015 · 6 revisions

Features

  • Full compliance with JSON specification (RFC4627) and reliable (see compliance testing)
  • 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
  • High performance (see [PerformanceTesting performance testing])
  • 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-version.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
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.

Maven Repository

Developer's Guide

Clone this wiki locally