# flightcontrolhq/superjson

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/flightcontrolhq-superjson).**

5,211 stars · 116 forks · TypeScript · mit

## Links

- GitHub: https://github.com/flightcontrolhq/superjson
- Homepage: https://www.flightcontrol.dev?ref=superjson
- awesome-repositories: https://awesome-repositories.com/repository/flightcontrolhq-superjson.md

## Topics

`blitzjs` `hacktoberfest` `javascript` `json` `superjson`

## Description

Superjson is a lossless JSON serialization library and data transcoder. It converts complex JavaScript and TypeScript data types into strings and metadata to ensure that type identity is preserved during data transfer.

The library preserves non-native types such as Dates, Maps, and Sets by splitting values into a JSON-compatible payload and a separate map of type-specific metadata. It utilizes a registry-based mapping system that allows for the definition of custom type handlers to manage third-party data types during serialization and deserialization.

This utility supports cross-process data communication and type-safe data transfer by restoring original object prototypes and complex data types. It performs encoding based on runtime types rather than using a predefined schema.

## Tags

### Data & Databases

- [Lossless](https://awesome-repositories.com/f/data-databases/data-transcoders/lossless.md) — Implements a lossless transcoding mechanism to preserve non-native types like Dates, Maps, and Sets during transport.
- [Type Fidelity Preservation](https://awesome-repositories.com/f/data-databases/json-fidelity-preservation/type-fidelity-preservation.md) — Implements lossless serialization that preserves complex JavaScript types like Maps and Sets.
- [Complex Data Serialization](https://awesome-repositories.com/f/data-databases/complex-data-serialization.md) — Converts non-standard types into a compatible string and metadata pair for lossless transport. ([source](https://cdn.jsdelivr.net/gh/flightcontrolhq/superjson@main/README.md))
- [Complex Data Type Exchange](https://awesome-repositories.com/f/data-databases/data-exchange-protocols/runtime-data-exchange/complex-data-type-exchange.md) — Restores complex data types from strings and metadata to maintain type fidelity after transfer. ([source](https://cdn.jsdelivr.net/gh/flightcontrolhq/superjson@main/README.md))
- [Custom Type Serializers](https://awesome-repositories.com/f/data-databases/data-type-managers/dynamic-type-managers/custom-type-serializers.md) — Allows the definition of custom serialization and deserialization logic for third-party data types. ([source](https://cdn.jsdelivr.net/gh/flightcontrolhq/superjson@main/README.md))
- [Metadata-Driven Serialization](https://awesome-repositories.com/f/data-databases/data-type-managers/dynamic-type-managers/custom-type-serializers/metadata-driven-serialization.md) — Serializes values by splitting them into a JSON-compatible payload and a separate map of type-specific metadata.
- [JSON Serialization Libraries](https://awesome-repositories.com/f/data-databases/json-serialization-libraries.md) — Provides a comprehensive library for converting complex JavaScript objects to and from JSON format.
- [Schema-Agnostic Ingestion](https://awesome-repositories.com/f/data-databases/schema-agnostic-ingestion.md) — Enables flexible data structures by encoding values based on runtime types without requiring a fixed schema.

### Software Engineering & Architecture

- [Type-Driven Deserialization](https://awesome-repositories.com/f/software-engineering-architecture/type-driven-deserialization.md) — Reconstructs original object prototypes by matching serialized metadata against registered handlers during deserialization.
- [Runtime Type Preservation](https://awesome-repositories.com/f/software-engineering-architecture/typescript-type-definitions/runtime-type-preservation.md) — Ensures TypeScript-defined classes and complex types maintain their identity when transferred between server and client.
- [Type Identity Preservation](https://awesome-repositories.com/f/software-engineering-architecture/typescript-type-definitions/type-identity-preservation.md) — Ensures that complex objects and class instances maintain their original identity and prototypes after being deserialized.
- [Type Mapping Registries](https://awesome-repositories.com/f/software-engineering-architecture/type-mapping-registries.md) — Maintains a central registry of handlers to manage the serialization of custom or third-party data types.
- [Type-Safe Data Handling](https://awesome-repositories.com/f/software-engineering-architecture/type-safe-data-handling.md) — Maintains type safety during data conversion by reconstructing original object prototypes upon deserialization.

### Web Development

- [JSON Encoding](https://awesome-repositories.com/f/web-development/json-encoding.md) — Provides lossless encoding of complex JavaScript types into JSON format while preserving type identity.

### Part of an Awesome List

- [JSON Transformation](https://awesome-repositories.com/f/awesome-lists/data/json-processing/json-transformation.md) — Acts as a transformation utility that revives non-native types during the JSON parsing process.

### Networking & Communication

- [Lossless JSON Transcoding](https://awesome-repositories.com/f/networking-communication/grpc-interfaces/grpc-web-bridging/lossless-json-transcoding.md) — Transcodes complex JavaScript types into a JSON-compatible payload with associated metadata for lossless recovery.

### Programming Languages & Runtimes

- [Runtime Type-Based Encoding](https://awesome-repositories.com/f/programming-languages-runtimes/runtime-execution-environments/runtime-environments/runtimes/type-definition-systems/runtime-type-dispatching/runtime-type-detection/runtime-type-based-encoding.md) — Determines serialization logic based on actual runtime types rather than relying on a predefined schema.
