org.json

  • The Java JSON library provides classes for working with JSON objects, arrays, strings, and tokens.

  • JSONArray represents an ordered list of values, while JSONObject stores unordered key-value pairs.

  • JSONStringer helps with creating JSON text, and JSONTokener is used for parsing JSON data from a string.

  • JSONException is the primary exception thrown when encountering JSON-related errors.

Classes

JSONArray A dense indexed sequence of values. 
JSONObject A modifiable set of name/value mappings. 
JSONStringer Implements JSONObject.toString() and JSONArray.toString()
JSONTokener Parses a JSON (RFC 4627) encoded string into the corresponding object. 

Exceptions

JSONException Thrown to indicate a problem with the JSON API.