Skip to content

feat(base-json): new JSON module with typed value model, reader/writer, and JSONTestSuite compliance#54

Merged
deer merged 4 commits intomainfrom
json
May 1, 2026
Merged

feat(base-json): new JSON module with typed value model, reader/writer, and JSONTestSuite compliance#54
deer merged 4 commits intomainfrom
json

Conversation

@deer
Copy link
Copy Markdown
Collaborator

@deer deer commented May 1, 2026

Introduces base-json, a new JPMS module providing a typed, immutable JSON value model — JsonValue as a sealed interface permitting JsonObject, JsonArray, JsonString, JsonNumber, JsonBoolean, and JsonNull. Includes a hand-written recursive-descent JsonReader (backed by base-parsing's AbstractParser/Rule framework), a JsonWriter with compact and pretty-print formatting, and fluent builder APIs for objects and arrays.

JsonObject preserves insertion order throughout — parsed objects, JsonObject.of(map), and the builder all use LinkedHashMap as the backing store, so key iteration order matches document order and round-trips are stable.

The JsonReader is validated against the full JSONTestSuite corpus: all y_ (must accept) and n_ (must reject) cases are enforced; i_ (implementation-defined) cases are accepted either way. Parse errors carry line, column, byte offset, and a JSON-pointer-style path to the failing value.

Inspired by https://openjdk.org/jeps/8344154.

@deer deer merged commit 54f652b into main May 1, 2026
3 checks passed
@deer deer deleted the json branch May 1, 2026 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant