fastify/fast-json-stringify

2x faster than JSON.stringify()

View on GitHub ↗Jump to charts ↓Open shareable report

Summary Information

Updated 3 minutes ago
Type:Library / SDKCategory(s):Core & Utility LibrariesLanguages & Runtimes
Added to GitGenius on September 18th, 2026
Created on July 27th, 2016
Open Issues & Pull Requests: 35 (+0)
GitHub issues: Enabled
Number of forks: 227
Total Stargazers: 3,705 (+0)
Total Subscribers: 27 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 1.5 hours
Mean response time: 27.6 days
90th percentile: 12.7 days
Tracked items: 68

Most active contributors

Sign in to see contributor activity.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 8
New in 7 days: 1
Closed in 7 days: 5
Avg open age: 790 days
Stale 30+ days: 2
Stale 90+ days: 2

Recent activity

Opened in 7 days: 1
Closed in 7 days: 5
Comments in 7 days: 0
Events in 7 days: 0

Top labels

  • bug (15)
  • benchmark (2)
  • good first issue (2)
  • question (2)
  • chore (1)

Detailed Description

fast-json-stringify is a code generation tool that produces optimized JSON serialization functions from JSON Schema definitions.

The tool addresses the performance limitations of the native JSON.stringify() method by taking a different approach: instead of serializing data at runtime with generic logic, it accepts a JSON Schema Draft 7 definition and generates a specialized stringify function tailored to that exact schema. This ahead-of-time code generation produces functions that are significantly faster than JSON.stringify() for small payloads, though the performance advantage diminishes as payload size increases.

Developers should choose this tool when serialization performance is a bottleneck and they can define their data structure as a JSON Schema. It suits projects that serialize the same data shapes repeatedly, such as API servers that return consistent response formats. The tool handles standard JSON types including strings, numbers, integers, booleans, arrays, and objects, plus specific cases like Date serialization to ISO strings, RegExp to strings, and BigInt to integers. It supports advanced schema features including pattern properties, additional properties, anyOf and oneOf unions, schema references via $ref, and nullable types. Configuration options allow control over integer rounding behavior, maximum nesting depth, large array handling mechanisms, and whether validators should be compiled eagerly or lazily.

The project maintains active development with regular updates addressing edge cases and performance optimizations. The codebase includes comprehensive documentation covering specific use cases, security considerations, debug mode for troubleshooting generated code, and a standalone mode for environments where runtime code generation is restricted. The tool integrates with Ajv for schema validation in complex scenarios and provides options to customize how validators are compiled and executed.