talira

JSON-java (org.json)

The reference JSON implementation for Java, in the public domain

open sourcepublic domainfree

JSON-java, the org.json package, is a reference implementation of JSON for Java: it parses JSON documents into Java objects (JSONObject, JSONArray) and generates JSON from them, and it can convert between JSON and XML, HTTP headers, cookies and CDL. It has no external dependencies, aims for strict adherence to the JSON specification and backward compatibility, and runs on Java 1.6 to 25. The code is in the public domain. The project is in a maintenance phase, so the changes it accepts are limited.

Problems it solves

  • parse a JSON string into objects in plain Java without pulling in a framework
  • convert XML to JSON in Java
  • a small JSON library for an old Java version

Features

  • parse and generate JSON with JSONObject and JSONArray
  • convert between JSON and XML, HTTP headers, cookies and CDL
  • no external dependencies
  • runs on Java 1.6 to 25

Limitations

  • In a maintenance phase: only limited changes are accepted1

Alternatives

The same job

These do what JSON-java (org.json) does.

  1. FASTJSON 2 High-performance JSON library for Java, the successor to fastjson
  2. Gson Google's Java library for converting objects to and from JSON
  3. Jackson The Java JSON library: a suite of data-processing tools for Java and the JVM
  4. json Ruby's JSON parser and generator, shipped with Ruby as a default gem
  5. Jayway JsonPath Query and update JSON documents in Java with XPath-like JsonPath expressions
  6. Moshi A modern JSON library for Android, Java and Kotlin

Compare JSON-java (org.json) with the top 3