Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,18 @@ The test data is bundled as ZIP files and extracted automatically at runtime:

## Current Status

**Final `java.util.json` sandbox-era release** (2026-05-19).
**2026.08.30 — the `jdk.incubator.json` backport release.**

This code is derived from the OpenJDK jdk-sandbox repository "json" branch at commit `43325738c` (2026-08-27), which is the current frontier of the incubator-era `jdk.incubator.json` API. The incubator promotion itself happened at commit `b956ae0` (2026-02-05); this branch completed the migration from the sandbox-era `java.util.json` naming to the incubator packages — see the notice below and issue #145.
This is a Java 21+ backport of the JDK's incubating JSON API (`jdk.incubator.json`, [JEP 540](https://openjdk.org/jeps/540), targeted at JDK 28), taken from the upstream `json` branch **as of commit `43325738c` (2026-08-27)**. The public API lives in `jdk.incubator.java.util.json` and the implementation in `jdk.incubator.internal.util.json`, mirroring the upstream module layout at that frontier.

> Note: the upstream commit may be a day or more old by the time you read this — the code here is exactly the upstream API and implementation **as of `43325738c`, 2026-08-27 23:24 UTC**, tracked continuously by the daily drift checker described below.

### Release highlights

- **The incubator API, not a legacy preview.** Conversion accessors are `asString()`, `asInt()`, `asLong()`, `asDouble()`, `asBoolean()`, `asList()`, `asMap()`; navigation is `get(String)`, `get(int)`, `tryGet(String)`, `tryValue()`; type and path errors throw `JsonValueException` with document paths; subtypes use identity `equals`/`hashCode`, matching the upstream specification. Earlier releases of this library exposed a different, sandbox-era API — migrating to this release is a small set of mechanical renames (`string()`→`asString()`, `toLong()`→`asLong()`, `elements()`→`asList()`, `members()`→`asMap()`, and so on).
- **Upstream hardening included.** The parser uses upstream's explicit-stack (non-recursive) design; the ported test suite covers documents nested 10,000 levels deep.
- **1,679 automated tests** (up from 1,355 in the previous release), including the complete upstream test suite ported to JUnit and hardened numeric-boundary coverage for `asInt`/`asLong`/`asDouble` ranges, precision, and `JsonNumber.of` conversions.
- **Automated breaking-change detection.** A daily CI job compares this backport's public API against upstream HEAD and opens a deduplicated issue on any drift; upstream unreachability is always treated as drift, never as all-clear. Sync tooling under `updates/` targets the incubator module layout, making each future sync a mechanical fetch-transform-verify cycle.

### API Summary
- `JsonValue` conversion methods: `asBoolean()`, `asString()`, `asInt()`, `asLong()`, `asDouble()`
Expand All @@ -300,8 +309,8 @@ This code is derived from the OpenJDK jdk-sandbox repository "json" branch at co
- `JsonObject`: `asMap()`, `of(Map)`
- `Json`: `parse(String)`, `parse(char[])`, `toDisplayString(JsonValue, String indent)`

### Upstream Migration Notice
The upstream `java.util.json` API has been promoted to `jdk.incubator.json` (commit `b956ae0`, 2026-02-05). The incubator version introduces significant API changes including method renames (`bool()`→`asBoolean()`, `string()`→`asString()`, `toInt()`→`asInt()`, etc.), `tryGet()`/`tryValue()` navigation, and identity (non-value) `equals`/`hashCode`. **That migration is now DONE in this branch** (issue #145): the public API lives in `jdk.incubator.java.util.json` and the implementation in `jdk.incubator.internal.util.json`, matching upstream frontier `43325738c`.
### Upstream alignment
Upstream promoted the API from the prototype `java.util.json` naming to the `jdk.incubator.json` incubator module (commit `b956ae0`, 2026-02-05); this release aligns fully with that module, including the renamed accessors, `tryGet()`/`tryValue()` navigation, and identity (non-value) `equals`/`hashCode`, at upstream frontier `43325738c` (issue #145).

The original proposal and design rationale can be found in the included PDF: [Towards a JSON API for the JDK.pdf](Towards%20a%20JSON%20API%20for%20the%20JDK.pdf)

Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
<div class="container">
<header>
<h1>java.util.json Backport for JDK 21+</h1>
<p class="subhead">A backport of the experimental <code>java.util.json</code> API from the OpenJDK jdk-sandbox “json” branch, plus an incubating JSON Type Definition (JTD) validator (RFC 8927).</p>
<p class="subhead">A Java 21+ backport of the JDK's incubating <code>jdk.incubator.json</code> API (JEP 540, targeted at JDK 28), plus a JSON Type Definition (JTD) validator (RFC 8927).</p>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Point the quick start at the incubator release

When a reader follows this newly updated incubator landing page, the Maven block at index.html:174-178 still installs 2026.01.26, an earlier sandbox-era artifact, while the example at line 182 imports jdk.incubator.java.util.json; copying the quick start therefore provides classes that do not match the example. Update the dependency to 2026.08.30 so the user documentation installs the release being advertised.

AGENTS.md reference: AGENTS.md:L29-L35

Useful? React with 👍 / 👎.

<div class="callout">
<strong>Early access / unstable:</strong> APIs and behaviour may change as upstream evolves.
</div>
Expand Down Expand Up @@ -254,7 +254,7 @@ <h2>JSON Type Definition (JTD) Validator</h2>
// result.isValid() == true</code></pre>

<h2>Status</h2>
<p class="meta">This code (as of 2026-01-25) is derived from the OpenJDK jdk-sandbox repository “json branch. The API may evolve as the upstream design develops.</p>
<p class="meta">This code is the upstream incubator API and implementation as of commit <code>43325738c</code> (2026-08-27) on the OpenJDK <code>json</code> branch, tracked daily for upstream drift. The API may evolve as upstream evolves.</p>

<h2>License</h2>
<p class="meta">GNU General Public License version 2 with Classpath exception (same as OpenJDK).</p>
Expand Down
2 changes: 1 addition & 1 deletion jdt2jar/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.github.simbo1905.json</groupId>
<artifactId>parent</artifactId>
<version>2026.08.28</version>
<version>2026.08.30</version>
</parent>

<artifactId>jdt2jar</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion json-compatibility-suite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.github.simbo1905.json</groupId>
<artifactId>parent</artifactId>
<version>2026.08.28</version>
<version>2026.08.30</version>
</parent>

<artifactId>json-compatibility-suite</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion json-java21-api-tracker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.github.simbo1905.json</groupId>
<artifactId>parent</artifactId>
<version>2026.08.28</version>
<version>2026.08.30</version>
</parent>

<artifactId>json-java21-api-tracker</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion json-java21-jsonpath/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.github.simbo1905.json</groupId>
<artifactId>parent</artifactId>
<version>2026.08.28</version>
<version>2026.08.30</version>
</parent>

<artifactId>java.util.json.jsonpath</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion json-java21-jtd-codegen/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.github.simbo1905.json</groupId>
<artifactId>parent</artifactId>
<version>2026.08.28</version>
<version>2026.08.30</version>
</parent>

<artifactId>java.util.json.jtd.codegen</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion json-java21-jtd/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.github.simbo1905.json</groupId>
<artifactId>parent</artifactId>
<version>2026.08.28</version>
<version>2026.08.30</version>
</parent>

<artifactId>java.util.json.jtd</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion json-java21/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.github.simbo1905.json</groupId>
<artifactId>parent</artifactId>
<version>2026.08.28</version>
<version>2026.08.30</version>
</parent>

<artifactId>java.util.json</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>io.github.simbo1905.json</groupId>
<artifactId>parent</artifactId>
<version>2026.08.28</version>
<version>2026.08.30</version>
<packaging>pom</packaging>

<name>java.util.json Java21 Backport Parent</name>
Expand Down
Loading