json-tree is a zero-dependency Java JSON library that supports dynamic processing of large payloads. It lazily parses to a virtual tree, keeps memory close to the source text, and gives you RFC 9535-style query, JSON Patch, diff, and schema validation in one small package—without Jackson’s object graph or multiple separate dependencies.
Javadoc - Intro - Standards and RFCs
- Rich lazy virtual tree API —
JsonMixed,JsonObject,JsonArray, and friends - Navigation — never-throwing
get(), three-state existence (missing/null/ value) - Search — RFC 9535-inspired path queries
- Patch — JSON Patch RFC 6902-based, order-independent ops by design
- Diff — structural comparison of two documents
- Validation — annotation-on-interface schema style
- Dialects — RFC 8259 plus a JSON5* dialect and
NaN/Infinityhandling - Zero dependencies, small codebase
See Standards and RFCs for full details on RFC compliance and extensions.
Also included, less central: text templating, JURL notation, input expressions.
| Here you get | Look elsewhere for |
|---|---|
| a tree with user types | POJO databind with annotations |
| control over details | a magic Java ~ JSON transformer |
| zero dependencies and a small audit surface | a large ecosystem with many options |
| batteries included (query + patch + diff + validate) | a core with an addon system |
| a pragmatic take on RFC standards | strict or full RFC compliance |
String json = """
{
"id": "abc",
"name": "Ada",
"roles": ["admin", "user"]
}""";
JsonObject root = JsonMixed.of(json);
String id = root.get("id").string(); // "abc"
int roleCount = root.get("roles").size(); // 2Navigation never throws. root.get("a").get("b").get("c") returns an undefined
node rather than null or an exception, and distinguishes three states that
Map-based APIs usually collapse: missing, present but null, and
present with a value.
However, on value access (a terminal operation) errors throw eagerly.
Data can use typed access as interfaces on top of the tree, so no annotations or reflection pass is needed:
interface User extends JsonObject {
String id();
String name();
}
User user = root.as(User.class);default-methods can be used to implement custom access logic
based on the generic tree API inherited from the base-type.
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>json-tree</artifactId>
<version>1.14.0</version>
</dependency>Get the full into →