Skip to content

Add JSONSerialization replacement and DOM API#6

Closed
vnixx wants to merge 1 commit intomainfrom
feature/json-serialization
Closed

Add JSONSerialization replacement and DOM API#6
vnixx wants to merge 1 commit intomainfrom
feature/json-serialization

Conversation

@vnixx
Copy link
Copy Markdown
Member

@vnixx vnixx commented Apr 14, 2026

Summary

Adds a high-performance JSONSerialization replacement and DOM-style JSON API, adapted from mattt/swift-yyjson (MIT License).

New Files

Source (5 files)

File Description
ReerJSONSerialization.swift Drop-in replacement for Foundation's JSONSerialization, backed by yyjson
Value.swift JSONValue, JSONDocument, JSONObject, JSONArray — DOM-style JSON access
Configuration.swift JSONReadOptions and JSONWriteOptions
Error.swift JSONError type
Helpers.swift Internal utilities (yyObjGet, yyFromString, etc.)

Tests (2 files, 185 tests)

File Tests
ReerJSONSerializationTests.swift 83 tests (reading, writing, validation, roundtrip, numbers, edge cases)
ValueTests.swift 102 tests (basic types, arrays, objects, documents, parsing, writing)

Naming

  • All YY prefixes removed (e.g. YYJSONValueJSONValue, YYJSONDocumentJSONDocument)
  • Exception: YYJSONSerializationReerJSONSerialization (project-specific prefix)
  • C-level constants (e.g. YYJSON_TYPE_NULL) unchanged

Attribution

  • All adapted files include MIT license attribution header referencing Mattt / swift-yyjson
  • README updated in both License and Acknowledgments sections

Tests

swift build
swift test — 185 new tests, all passing ✅

Adapted from mattt/swift-yyjson (MIT License):
- ReerJSONSerialization: drop-in replacement for Foundation JSONSerialization
- JSONValue/JSONDocument/JSONObject/JSONArray: DOM-style JSON API
- Configuration (JSONReadOptions/JSONWriteOptions)
- JSONError type
- Helpers (internal utilities)

Tests: 185 tests ported from Swift Testing to XCTest, all passing.
README: added attribution in License and Acknowledgments sections.
@vnixx vnixx closed this Apr 14, 2026
@vnixx vnixx changed the title Add JSONSerialization replacement and DOM API adapted from swift-yyjson Add JSONSerialization replacement and DOM API Apr 14, 2026
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