Skip to content

v0.4.0

Choose a tag to compare

@ehsanmok ehsanmok released this 14 Sep 03:46

Highlights

  • Installing json brings in mojo and simdjson and nothing else. The CPU path has no MAX dependency. GPU parsing is opt-in: import loads from json.gpu and add max-core yourself, which is covered by the Modular Community License rather than by MIT.
  • JSONPath implements RFC 9535. Filters gained logical operators, parentheses, existence tests and root references. Unions work, so do Normalized Paths and the function extensions length, count, match, search and value. $[::-1] used to loop forever reading out of bounds, and every open-ended slice quietly dropped its last element. Both are fixed.
  • JSON Schema implements draft 2020-12. $ref resolves; it was ignored before, so any schema using one reported every document valid. pattern runs a real I-Regexp engine rather than comparing literals. unevaluatedProperties and unevaluatedItems work.
  • One JSON Pointer implementation replaces three that disagreed with each other. JSON Patch is atomic, test compares numbers by value and ignores member order, and operations fail where the RFC says they must.
  • I-JSON mode, through ParserConfig.interoperable() (RFC 7493).
  • Value behaves like a JSON value: len, in, iteration, items(), keys(), values(), __hash__, structural ==, __setitem__, remove, negative indices, and raising as_int()-style accessors alongside the non-raising ones.
  • Typed deserialization is roughly twice as quick on every shape, and telemetry serialization is down 30%.

Conformance

Every standard below is checked by a catalog or a suite that runs in pixi run tests-cpu, which is the CI test job on Linux and macOS. The known-gap lists are empty.

Standard Checks Result
RFC 8259 JSON 312 asserted, 35 informational 0 unexpected failures
RFC 7493 I-JSON 6 asserted 0 unexpected failures
RFC 6901 JSON Pointer 18 asserted 0 unexpected failures
RFC 6902 JSON Patch 27 asserted 0 unexpected failures
RFC 7396 Merge Patch 21 asserted, 3 informational 0 unexpected failures
JSON Schema 2020-12 197 asserted 0 failures, 44 of 44 keywords
RFC 9535 JSONPath 80 tests all pass
RFC 9485 I-Regexp 32 tests all pass

Breaking changes

  • get(key) returns Optional[Value]. It used to return the member's raw JSON text and raise when the key was absent; that behaviour is now raw_member(key).
  • == on containers compares structurally, ignoring member order and treating 1 and 1.0 as equal. It used to compare serialized text.
  • loads[target="gpu"] and load[target="gpu"] move from json to json.gpu, with the same signature. Add max-core to your dependencies.

Install

[dependencies]
json = { git = "https://github.com/ehsanmok/json.git", tag = "v0.4.0" }

For GPU parsing add max-core = ">=26.5.0" and import from json.gpu. See json/gpu/LICENSE-GPU.md for what that licence asks of you.