Repository navigation
v2.0.0
·
185 commits
to main
since this release
Immutable
release. Only release title and notes can be modified.
Hey y'all!
json-as 2.0.0 is here! This release brings faster generated readers, stricter opt-in validation, more reliable lazy fields and dynamic values, and a whole bunch of correctness fixes. It includes everything since v1.6.3; the planned v1.7.0 was never published.
What’s new
- Added
JSON.validate(data)for complete syntax validation without building a result. Opt-inJSON_STRICT=truebuilds combine validation with typed cursor parsing where supported. - Added
JSON_DIAGNOSTICS=falsefor production builds that trap on library parse failures without constructing detailed errors. Checks remain in place; detailed diagnostics are enabled by default. - Expanded generic, alias, inheritance, lazy-field, and custom-codec support across both package entry points. (#246)
- Switched project code to MPL-2.0, with SPDX headers, retained third-party notices, and automated license checks.
Performance
- Improved generated compact and whitespace readers, expected-order key dispatch, composite scanning, and numeric parsing. Each parse starts at the fastest tier and falls back as needed.
- Moved more schema decisions to compilation time, reduced repeated scanning and unnecessary allocation, and kept fast readers available for safe standard-library numeric defaults.
- Refreshed the benchmark charts, including native-struct comparisons with simdjson and built-in JavaScript. Owning-struct serialization measures fresh output rather than forwarding a cached JSON string.
Fixes
- Fixed numeric conversion and round-trip edges, including exact wide integers, decimal-to-float rounding, signed zero, and alias-bound floating-point fields.
- Fixed omitted defaults on reused destinations, shared-buffer overwrites, native container subclass behavior, and managed-value lifetimes during garbage collection. (#236, #247)
- Fixed lazy inheritance shadowing, declaration-scoped omission predicates, imported and default-exported models, and native-type name collisions.
- Fixed malformed token handling, nullable array elements, string escaping, static output-string reuse, and backend consistency. (#229, #234, #242)
- Fixed installed-package resolution in pnpm projects and workspaces by bundling xjb-as and declaring the AssemblyScript compiler peer dependency.
Upgrading from 1.x
- Omitted fields in reused parse destinations return to their declared defaults. Present members can still reuse buffers.
- Undecorated built-in subclasses use native storage operations. Use custom codecs to customize their JSON representation.
- Dynamic numeric getters convert between numeric types using native casts. Parsed dynamic numbers use
f64; preserve typed integer values when exact wide-integer storage matters. - Review the full changelog for the complete compatibility notes and fixes.
Testing
- The release candidate passed all eight hosted test shards, lint, and license checks.
- Packed-package checks covered both entry points, all three backends and runtimes, strict parsing on/off, and actual npm/pnpm consumer installations.
- Expanded regression coverage includes parsing, initialization, reuse, dynamic values, compiler bindings, and container subclasses.
As always, try it, break it, and tell us what feels rough!
Join the AssemblyScript Discord or open an issue with feedback. I'd love to hear how 2.0 works for you 😄
Full Changelog: v1.6.3...v2.0.0