JSON in Java


The JSON data interchange format is easily supported in Java. Free source code is available. It is provided without support or warranty. Use at your own risk. Please do not use it for evil. Feedback is welcome. Thank you.

Source Javadoc Description
JSONObject.java JSONObject.html A JSONObject is an unordered collection of name/value pairs. Its external form is a string wrapped in curly braces with colons between the names and values, and commas between the values and names. The internal form is an object having get() and opt() methods for accessing the values by name, and put() methods for adding or replacing values by name. The values can be any of these types: Boolean, JSONArray, JSONObject, Number, and String, or the JSONObject.NULL object.
JSONArray.java JSONArray.html A JSONArray is an ordered sequence of values. Its external form is a string wrapped in square brackets with commas between the values. The internal form is an object having get() and opt() methods for accessing the values by index, and put() methods for adding or replacing values. The values can be any of these types: Boolean, JSONArray, JSONObject, Number, and String, or the JSONObject.NULL object.
JSONStringer.java JSONStringer.html A JSONStringer is a tool for rapidly producing JSON text.
JSONWriter.java JSONWriter.html A JSONWriter is a tool for rapidly writing JSON text to streams.
JSONTokener.java JSONTokener.html A JSONTokener takes a source string and extracts characters and tokens from it. It is used by the JSONObject and JSONArray constructors to parse JSON source strings.
JSONException.java JSONException.html A JSONException is thrown when a syntax or procedural error is detected.
JSONString.java JSONString.html The JSONString is an interface that allows classes to implement their JSON serialization.
JSON can also be used as a data interchange format between other data interchange formats.
CDL.java CDL.html This provides static methods to convert comma delimited list text into a JSONArray, and to covert a JSONArray into comma delimited list text. Comma delimited list text is a very popular format for data interchange. It is understood by most database, spreadsheet, and organizer programs.
XML.java XML.html This provides static methods to convert an XML text into a JSONObject, and to covert a JSONObject into an XML text.
JSONML.java JSONML.html This provides static methods to convert an XML text into a JSONArray or JSONObject, and to covert a JSONArray or JSONObject into an XML text using the JsonML transform.
XMLTokener.java XMLTokener.html The XMLTokener extends the JSONTokener to provide additional methods for the parsing of XML texts.
HTTP.java HTTP.html Convert an HTTP header to a JSONObject and back.
HTTPTokener.java HTTPTokener.html The HTTPTokener extends the JSONTokener to provide additional methods for the parsing of HTTP headers.
Cookie.java Cookie.html Convert a web browser cookie specification to a JSON object and back.
CookieList.java CookieList.html Convert a web browser cookie list string to a JSON object and back.