Back to Explore

fastify/fast-json-stringify

GitHub
12 updates · last 90 daysOpen source

Last release:

fast-json-stringify builds a fast JSON `stringify()` function from a JSON Schema (Draft 7), useful when you want faster serialization for small payloads than `JSON.stringify()`. It supports common JSON types and nested schemas, with special handling for values like `Date`, `RegExp`, and `BigInt`, and it is built to generate functions ahead of time using the provided schema.

Project status

  • Actively maintained, with an upstream push on 2026-11-04 and updates as recently as 2026-11-01.
  • Recent updates have been frequent and clustered, including several in October and early November 2026.

AI summary generated

AI-generated from public sources. May be inaccurate. Report

Recent updates

  • v7.3.3

    v7.3.3 fixes stack overflows when compiling schemas with multiple recursive references in anyOf, and supports a property named $id inside anyOf and oneOf. The diff changes schema ID detection and reference merging, with no public API signature or export changes.

  • v7.3.2

    v7.3.2 fixes mutation of multi-type schema arrays by sorting a copy rather than the caller's array. The release notes also describe reusable functions for non-recursive external `$ref` schemas, but that implementation change is not visible in the supplied code diff.

    Features
  • v7.3.1

    Version 7.3.1 fixes `objectMechanism: 'native'` so invalid non-string, non-Date values for date-time, date, and time fields are rejected instead of being stringified. The change aligns this behavior with the default mechanism; users not using native object serialization are unaffected.

    Breaking
  • v7.3.0

    v7.3.0 adds an opt-in `objectMechanism: 'native'` serialization path that projects schema-approved values into scratch objects and delegates JSON generation to native `JSON.stringify`. The default mechanism remains unchanged, and the new path is gated by the Node.js version and schema shape.

    Features
  • v7.2.1

    Version 7.2.1 fixes serialization of nullable items in tuple-style array schemas, allowing null values where an item schema sets `nullable: true`. The release also updates the reusable release workflow reference.

  • v7.2.0

    v7.2.0 adds a runtime-dependent copy-then-JSON.stringify cutoff for plain string arrays, following the existing approach for number and integer arrays. The output remains unchanged, and largeArraySize no longer controls the cutoff for plain primitive arrays under the default mechanism.

  • v7.1.5

    v7.1.5 is a focused fix for Ajv strict-type warnings caused by converting `propertyNames` schemas. It also adjusts recursive schema conversion so nested schemas inside schema-map keywords continue to be converted correctly.

  • v7.1.4

    v7.1.4 changes `$ref` handling so non-annotation sibling keywords are merged with the referenced schema and can now affect serialization validation. The release also adds handling for recursive references and tests for internal, external, and conflicting references.

    Breaking
  • v7.1.3

    v7.1.3 fixes Ajv strict-schema option handling and standalone validator state, and improves primitive-array serialization performance on supported V8 versions. No intentional breaking changes or dependency updates are documented.

  • v7.1.2

    v7.1.2 focuses on performance improvements and a correctness fix for JSON schema composition. It speeds up build() and large array serialization (notably for strings, numbers, and integers) and fixes allOf handling so property constraints are preserved when additionalProperties is false.

  • v7.1.1

    v7.1.1 includes two changes described in the release notes: benchmark string flattening and scoping large array mechanism options per build() call. The code diff confirms the build option scoping fix, but also shows additional related behavior: largeArraySize is also scoped per build, not just largeArrayMechanism.

  • v7.1.0

    v7.1.0 adds new build options to control schema compilation depth (maxDepth) and to change how Ajv validators are handled, including optional inline validators for standalone output and optional eager compilation of validators for conditional keywords. The release also includes multiple correctness and performance fixes around schema ref handling, additionalProperties behavior, and escaping of date/time formatted strings.

    BreakingFeatures
  • v7.0.1

    v7.0.1 is primarily a set of maintenance and bug fixes, including a fix for valid JSON serialization of schema `const` string values and a fix for stray comma generation in certain object schemas. It also bumps `fast-uri` to v4.0.0 and updates Dependabot scheduling/config, plus small README and docs link corrections.

  • v7.0.0

    Release v7.0.0 removes the deprecated `debugMode` option from fast-json-stringify. The tests and TypeScript typings are updated to use `mode: 'debug'` instead.

    Breaking
  • v6.4.0

    v6.4.0 focuses on maintenance work (CI/tooling updates), improved benchmark/test coverage, and a functional fix around how external $ref schemas are handled. The notable functional change is a fix intended to extract reusable serializer logic for non-recursive external $ref schemas, reducing duplicated inlining.

  • v6.3.0

    v6.3.0 focuses on performance improvements in the generated JSON stringifiers, plus a fix/feature for handling tuple-like schemas with item $ref. The release notes also include dev and benchmark maintenance changes, including the tinybench upgrade and updating benchmark format labels.

  • v6.2.0

    v6.2.0 focuses on performance improvements (serializer codegen refactors, monomorphic variables, and reduced comma handling) and CI/benchmarking changes. It also updates the custom Ajv keyword fjs_type validation to recognize values that implement a toJSON method. Release notes do not mention any user-facing behavior changes around object schema features like additionalProperties or recursive schema handling.

  • v6.1.1

    v6.1.1 is a small patch release that reverts an earlier change related to string escaping behavior. The code changes focus on how the serializer decides when it can return an unescaped string vs when it must escape characters to keep output valid JSON.

  • v6.1.0

    fast-json-stringify v6.1.0 focuses on performance improvements in the code generator and serializer, with additional CI and workflow maintenance. The release notes document multiple perf refactors, a switch to Node-main branding, and dependency bumps, including json-schema-ref-resolver v3.

  • v6.0.1

    v6.0.1 is a maintenance release focused on dependency updates, test migration from tap to node:test, and repository/style cleanup. The library runtime code changes visible in the diff are minimal (mostly var/const style refactors), while most changes affect test infrastructure, linting, and CI configuration.

    Breaking