Skip to content

Commit 78ef6dc

Browse files
author
Simon Massey
authored
Update README.md
1 parent dfa4274 commit 78ef6dc

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

README.md

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,34 @@
11
# java.util.json Backport for JDK 21+
22

3-
Early access to the future `java.util.json` API - taken from OpenJDK sandbox July 2025.
3+
Early access to the unstable `java.util.json` API - taken from OpenJDK sandbox July 2025.
44

5-
## Project Vision
6-
7-
This project provides Java developers with early access to the future `java.util.json` API today, allowing code written against this API to migrate seamlessly when the official API is released.
8-
## Current Status
5+
## Back Port Project Goals
96

10-
This code is derived from the official OpenJDK sandbox repository at commit [d22dc2ba89789041c3908cdaafadc1dcf8882ebf](https://github.com/openjdk/jdk-sandbox/commit/d22dc2ba89789041c3908cdaafadc1dcf8882ebf) (Mid July 2025 "Improve hash code spec wording").
7+
- **✅Enable early adoption**: Let developers try the unstable Java JSON patterns today on JDK 21+
8+
- **✅API compatibility over performance**: Focus on matching the emerging "batteries included" API design rather than competing with existing JSON libraries on speed.
9+
- **✅Track any official solution** track any `java.util.json` with matching API updates to be a potential "unofficial backport".
10+
- **✅Host Examples / Counter Examples** if anyone has any interest. GitHub wiki can be used for this if there is community interest.
1111

12-
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)
12+
## Non-Goals
1313

14-
## Back Port Project Goals
14+
- **🛑Performance competition**: This backport is not intended to be the fastest JSON library. The JDK internal annotations that boost performance had to be removed.
15+
- **🛑Feature additions**: No features beyond what's in the official sandbox/preview public API. Demos and example code are most welcome.
16+
- **🛑Production optimization**: The final official implementation will have cutrent and future JVM-level optimizations unavailable to a backport on Java 21.
17+
- **🛑API stability**: This backport may, or may not, track the official specification develops (only if folks find it useful).
18+
- **🛑Advoocacy / Counter Advocacy**: This repo is not an endorsement of the proposed API nor a rejection of other solutions. Please only use the official Java email lists to debate the topic.
1519

16-
- **Enable early adoption**: Let developers use future Java JSON patterns today on JDK 21+
17-
- **Smooth migration path**: Code written against this API should require less changes when migrating to the eventual official release
18-
- **API compatibility over performance**: Focus on matching the emerging "batteries included" API design rather than competing with existing JSON libraries on speed
20+
## Current Status
1921

20-
## Non-Goals
22+
This code (as at July 2025) is derived from the official OpenJDK sandbox repository at commit [d22dc2ba89789041c3908cdaafadc1dcf8882ebf](https://github.com/openjdk/jdk-sandbox/commit/d22dc2ba89789041c3908cdaafadc1dcf8882ebf) (Mid July 2025 "Improve hash code spec wording").
2123

22-
- **Performance competition**: This is not intended to be the fastest JSON library the JDK internal annotations had to be removed.
23-
- **Feature additions**: No features beyond what's in the official sandbox/preview.
24-
- **Production optimization**: The final official implementation will have JVM-level optimizations unavailable to a backport on Java 21.
25-
- **API stability**: This backport may evolve as the official specification develops (only if folks find it useful)
24+
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)
2625

2726
## Modifications
2827

2928
This is a simplified backport with the following changes from the original:
30-
- Replaced StableValue optimizations with double-checked locking pattern
31-
- Removed value-based class annotations
32-
- Basic implementation without advanced performance optimizations
33-
- Compatible with JDK 21+ instead of future JDK versions
29+
- Replaced StableValue with double-checked locking pattern.
30+
- Removed value-based class annotations.
31+
- Compatible with JDK 21.
3432

3533
## Building
3634

@@ -57,6 +55,7 @@ The API provides immutable JSON value types:
5755
- `JsonNull` - JSON null
5856

5957
Parsing is done via the `Json` class:
58+
6059
```java
6160
JsonValue value = Json.parse(jsonString);
6261
```
@@ -66,6 +65,7 @@ JsonValue value = Json.parse(jsonString);
6665
The `Json` class provides bidirectional conversion between `JsonValue` objects and standard Java types:
6766

6867
### Converting from Java Objects to JSON (`fromUntyped`)
68+
6969
```java
7070
// Convert standard Java collections to JsonValue
7171
Map<String, Object> data = Map.of(
@@ -77,6 +77,7 @@ JsonValue json = Json.fromUntyped(data);
7777
```
7878

7979
### Converting from JSON to Java Objects (`toUntyped`)
80+
8081
```java
8182
// Convert JsonValue back to standard Java types
8283
JsonValue parsed = Json.parse("{\"name\":\"John\",\"age\":30}");
@@ -101,7 +102,7 @@ This is useful for:
101102

102103
### Record Mapping
103104

104-
The most powerful feature is mapping between Java records and JSON:
105+
A powerful feature is mapping between Java records and JSON:
105106

106107
```java
107108
// Domain model using records

0 commit comments

Comments
 (0)