explaingit

stleary/json-java

4,714JavaAudience · developerComplexity · 2/5Setup · easy

TLDR

The original Java library for reading and writing JSON data. Convert JSON text into Java objects and back again with no external dependencies. Widely used in Android apps and projects needing simple, reliable JSON handling.

Mindmap

mindmap
  root((JSON-java))
    What it does
      Parse JSON to Java
      Build JSON from Java
      XML and CSV convert
      No dependencies needed
    Tech stack
      Java language
      org.json package
      Android compatible
    Key classes
      JSONObject
      JSONArray
    Audience
      Java developers
      Android developers
      Backend engineers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Parse a JSON string from a web API response into a Java object you can read and manipulate.

USE CASE 2

Build a JSON object from scratch in Java and serialize it to a string to send to an API.

USE CASE 3

Convert XML data to JSON format or JSON data to XML using the built-in conversion utilities.

USE CASE 4

Handle JSON in an Android app without adding any third-party dependencies to your project.

Tech stack

Javaorg.jsonJSONXMLCSV

Getting it running

Difficulty · easy Time to first run · 5min

Add org.json as a Maven or Gradle dependency. No additional setup required, it has zero external dependencies and works with any standard Java or Android project.

Open-source with a permissive license, license not specified in detail in the explanation.

In plain English

JSON-java (published under the package name org.json) is a reference implementation of JSON handling for the Java programming language. JSON is a simple text format for storing and exchanging structured data, and this library gives Java programs a straightforward way to read JSON text into Java objects and to produce JSON output from Java data. It is one of the oldest and most widely referenced JSON libraries in the Java ecosystem. Beyond basic JSON parsing and generation, the library also includes converters between JSON and several other formats: XML, HTTP headers, cookies, and CDL (a comma-delimited format). These converters let you translate data between JSON and those formats without writing the conversion logic yourself. The library has no external dependencies, meaning you can include it in a project without pulling in any other libraries. It is designed to work on a wide range of Java versions, from Java 1.6 through the current Java 25, which makes it practical for projects that must support older runtimes. The project is in the public domain, which means there are no conditions on use, modification, or redistribution. No attribution is required. The README notes this can sometimes cause uncertainty for corporate legal teams and suggests referencing the Unlicense or CC0 1.0 when explaining the terms to a legal department, since those have equivalent meaning and are more widely recognized. The project is currently in a maintenance phase. Bug fixes and test coverage improvements are accepted, but significant new features are not. Build instructions cover the command line, Maven, and Gradle. A pre-built jar file is available directly from Maven Central for projects that do not want to build from source.

Copy-paste prompts

Prompt 1
Using org.json in Java, show me how to parse a JSON string from an API response and extract specific field values from it.
Prompt 2
How do I create a JSONObject in Java using org.json, add several key-value pairs to it, and convert it to a string to send in an HTTP request?
Prompt 3
Using org.json, how do I parse a JSON array string and loop through each item to read its properties?
Prompt 4
Show me how to convert an XML string to a JSONObject using org.json's XML utility class in Java.
Prompt 5
How do I handle nested JSON objects inside another JSON object using org.json's JSONObject class in Java?
Open on GitHub → Explain another repo

← stleary on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.