🌐
GitHub
github.com › stleary › JSON-java
GitHub - stleary/JSON-java: A reference implementation of a JSON package in Java. · GitHub
The JSON-Java package is a reference implementation that demonstrates how to parse JSON documents into Java objects and how to generate new JSON documents from the Java classes.
Starred by 4.7K users
Forked by 2.6K users
Languages   Java
🌐
GitHub
github.com › mitchhentges › json-parse
GitHub - mitchhentges/json-parse: Super-fast Java JSON parser
A tool to quickly parse JSON into Java maps and lists.
Starred by 17 users
Forked by 6 users
Languages   Java 100.0% | Java 100.0%
🌐
GitHub
github.com › a2800276 › json.java
GitHub - a2800276/json.java: simple json parser for java
simple json parser for java. Contribute to a2800276/json.java development by creating an account on GitHub.
Author   a2800276
🌐
GitHub
github.com › ralfstx › minimal-json
GitHub - ralfstx/minimal-json: A fast and small JSON parser and writer for Java
A fast and minimal JSON parser and writer for Java.
Starred by 739 users
Forked by 187 users
Languages   Java 93.9% | JavaScript 4.4% | Java 93.9% | JavaScript 4.4%
🌐
GitHub
github.com › simdjson › simdjson-java
GitHub - simdjson/simdjson-java: A Java version of simdjson, a high-performance JSON parser utilizing SIMD instructions · GitHub
A Java version of simdjson, a high-performance JSON parser utilizing SIMD instructions - simdjson/simdjson-java
Starred by 414 users
Forked by 35 users
Languages   Java 99.9% | Scala 0.1%
🌐
GitHub
github.com › mmastrac › nanojson
GitHub - mmastrac/nanojson: A tiny, compliant JSON parser and writer for Java
There are three entry points for parsing, depending on the type of JSON object you expect to parse: JsonParser.object().from(), JsonParser.array().from(), and JsonParser.any().from(). You pass them a String or a Reader and they will either return the parsed object of a given type or throw a ...
Starred by 109 users
Forked by 27 users
Languages   Java 100.0% | Java 100.0%
🌐
GitHub
github.com › fangyidong › json-simple › blob › master › src › main › java › org › json › simple › parser › JSONParser.java
json-simple/src/main/java/org/json/simple/parser/JSONParser.java at master · fangyidong/json-simple
import java.util.Map; · · import org.json.simple.JSONArray; · import org.json.simple.JSONObject; · · · /** · * Parser for JSON text. Please note that JSONParser is NOT thread-safe. · * · * @author FangYidong<fangyidong@yahoo.com.cn> ·
Author   fangyidong
🌐
GitHub
github.com › antonsjava › json
GitHub - antonsjava/json: json - small library for manipulating json data structures
json - small library for manipulating json data structures - antonsjava/json
Author   antonsjava
🌐
GitHub
github.com › markenwerk › java-utils-json-parser
GitHub - markenwerk/java-utils-json-parser: An event based JSON parser for Java
This library provides a pair of lightweight event based JSON parsers (a pull parser and a push parser) for JSON as specified in RFC 7159 and ECMA-404.
Author   markenwerk
Find elsewhere
🌐
GitHub
github.com › topics › json-parsing
json-parsing · GitHub Topics · GitHub
json parsing scheduled-tasks http-client stack-traces json-parser converts-string interval json-parsing time-interval version-parser lifecycle-management unicode-converter parse-strings stacktrace-filtering mgnt ... notifications music firebase volley sqlite-database retrofit moshi glide butterknife sqlite-android firebase-auth notification-android json-parsing volley-api runtime-permissions appcompat-v7 intentservice music-streaming-application boundservice ... Java module for parse http json more easy.
🌐
GitHub
github.com › kishandonga › JsonParser
GitHub - kishandonga/JsonParser: Java JSON Parsing By Path and Key, where you have to provide path of the key and accordingly all the values your get in the callback.
Java JSON Parsing By Path and Key, where you have to provide path of the key and accordingly all the values your get in the callback. - kishandonga/JsonParser
Author   kishandonga
🌐
Tnakamot
tnakamot.github.io › json-parser
Java JSON Parser
<dependency> <groupId>com.github.tnakamot</groupId> <artifactId>json-parser</artifactId> <version>0.2.1</version> </dependency> ... Import the following packages in your Java source code.
🌐
GitHub
github.com › topics › json-parser
json-parser · GitHub Topics · GitHub
android java sql orm functional-programming nosql jdbc matrix http-client json-parser xml-parser sql-builder · Updated · Jun 21, 2022 · Java · Star 70 · A very fast, very lazy JSON parser for Java. java json parsing json-data json-parser lazyjson doubledutch ·
🌐
GitHub
github.com › FasterXML › jackson-1 › blob › master › src › java › org › codehaus › jackson › JsonParser.java
jackson-1/src/java/org/codehaus/jackson/JsonParser.java at master · FasterXML/jackson-1
throw new UnsupportedOperationException("Parser of type "+getClass().getName()+" does not support schema of type '" ... * @param str Property name to compare next token to (if next token is <code>JsonToken.FIELD_NAME<code>)
Author   FasterXML
🌐
GitHub
github.com › manishdait › json-parser
GitHub - manishdait/json-parser: A lightweight, educational JSON parser implemented from scratch in Java.
The parse() method then returns a structured Java object representing the JSON data. import com.example.parser.JsonParser; import com.example.parser.JsonParsingError; import com.example.model.JsonObject; import com.example.model.JsonString; import com.example.model.JsonNumber; import com.example.model.JsonBoolean; import com.example.model.JsonArray; import com.example.model.JsonValue; // Base class for all JSON types public class DemoStringParsing { public static void main(String[] args) { String jsonString = "{\"name\": \"Alice\", \"age\": 30, \"isStudent\": true, \"courses\": [\"Math\", \"Ph
Author   manishdait
🌐
GitHub
github.com › Instagram › ig-json-parser
GitHub - Instagram/ig-json-parser: Fast JSON parser for java projects · GitHub
For Java projects, to use this library, add this to your build.gradle file: allprojects { repositories { maven { url 'https://jitpack.io' } } } ... dependencies { implementation 'com.github.instagram.ig-json-parser:runtime:master-SNAPSHOT' // the runtime implementation 'com.github.instagram.ig-json-parser:processor:master-SNAPSHOT' // the annotation processor }
Starred by 1.3K users
Forked by 127 users
Languages   Java 88.4% | Kotlin 11.6%
🌐
GitHub
github.com › javaparser › javaparser
GitHub - javaparser/javaparser: Java 1-25 Parser and Abstract Syntax Tree for Java with advanced analysis functionalities. · GitHub
<dependency> <groupId>com.github.javaparser</groupId> <artifactId>javaparser-core</artifactId> <version>3.28.0</version> </dependency> ... Since version 3.6.17 the AST can be serialized to JSON.
Starred by 6.1K users
Forked by 1.2K users
Languages   Java
Top answer
1 of 16
962

The org.json library is easy to use.

Just remember (while casting or using methods like getJSONObject and getJSONArray) that in JSON notation

  • [ … ] represents an array, so library will parse it to JSONArray
  • { … } represents an object, so library will parse it to JSONObject

Example code below:

import org.json.*;

String jsonString = ... ; //assign your JSON String here
JSONObject obj = new JSONObject(jsonString);
String pageName = obj.getJSONObject("pageInfo").getString("pageName");

JSONArray arr = obj.getJSONArray("posts"); // notice that `"posts": [...]`
for (int i = 0; i < arr.length(); i++)
{
    String post_id = arr.getJSONObject(i).getString("post_id");
    ......
}

You may find more examples from: Parse JSON in Java

Downloadable jar: http://mvnrepository.com/artifact/org.json/json

2 of 16
714

For the sake of the example lets assume you have a class Person with just a name.

private class Person {
    public String name;

    public Person(String name) {
        this.name = name;
    }
}

Jackson (Maven)

My personal favourite and probably the most widely used.

ObjectMapper mapper = new ObjectMapper();

// De-serialize to an object
Person user = mapper.readValue("{\"name\": \"John\"}", Person.class);
System.out.println(user.name); //John

// Read a single attribute
JsonNode nameNode = mapper.readTree("{\"name\": \"John\"}");
System.out.println(nameNode.get("name").asText());

Google GSON (Maven)

Gson g = new Gson();

// De-serialize to an object
Person person = g.fromJson("{\"name\": \"John\"}", Person.class);
System.out.println(person.name); //John

// Read a single attribute
JsonObject jsonObject = new JsonParser().parseString("{\"name\": \"John\"}").getAsJsonObject();
System.out.println(jsonObject.get("name").getAsString()); //John

Org.JSON (Maven)

This suggestion is listed here simply because it appears to be quite popular due to stackoverflow reference to it. I would not recommend using it as it is more a proof-of-concept project than an actual library.

JSONObject obj = new JSONObject("{\"name\": \"John\"}");

System.out.println(obj.getString("name")); //John
🌐
GitHub
github.com › Th3Wol7 › JSON-Parser
GitHub - Th3Wol7/JSON-Parser: JSON parser build using Java Reflections API to demonstrate my knowledge of reflections · GitHub
This project provides a simple and flexible way to convert JSON strings to POJOs (Plain Old Java Objects) and vice versa. It uses reflection to dynamically create objects and populate their fields from JSON, and to generate JSON from existing objects. Flexible Mapping: The parser can handle ...
Author   Th3Wol7
🌐
GitHub
github.com › jjenkov › parsers-in-java
GitHub - jjenkov/parsers-in-java: A JSON parser implemented in Java, to show how to implement high performance parsers in Java.
A JSON parser implemented in Java, to show how to implement high performance parsers in Java. - jjenkov/parsers-in-java
Starred by 109 users
Forked by 33 users
Languages   Java 95.0% | Shell 5.0% | Java 95.0% | Shell 5.0%