Ad

TypedJSON: Type-safe JSON for TypeScript

TypedJSON parses and serializes JSON to/from TypeScript classes, preserving type information for enhanced type safety and reduced syntax. It facilitates seamless integration with existing code using decorators and supports complex object structures.
Screenshot of JohnWeisz/TypedJSON homepage

TypedJSON parses standard JSON data into typed TypeScript class instances. It achieves this by using decorators to annotate class properties, effectively mapping JSON fields to class members. This eliminates the need to explicitly define types in the JSON, promoting type safety and reducing boilerplate code. Primarily designed for TypeScript projects, it simplifies data handling and object serialization.

TypedJSON provides a lightweight and convenient way to map JSON data to TypeScript classes. Its decorator-based approach offers clean syntax and minimal code additions. It facilitates handling of arrays, sets, and maps. It supports complex, nested object structures, offering a robust solution for various data serialization and deserialization needs.

  • Type Safety: Parses JSON into typed class instances, ensuring type correctness.
  • Decorator-Based: Leverages decorators for clean and concise annotation of class members.
  • Collection Support: Handles arrays, sets, and maps with decorators for collection members.
  • Complex Structures: Supports nested objects and complex object trees.
  • Flexible Mapping: mapType allows custom deserialization/serialization logic for specific types.
  • Any Type: Completely bypasses type checking for untyped JSON with the AnyT type.
  • Extensible: Supports custom types and custom serialization/deserialization logic.

TypedJSON is a stable library with consistent maintenance. Recent commits indicate active development and support. Comprehensive documentation and examples are available, and it has a moderate community presence, earning a respectable number of stars and forks. The project is well-tested and has demonstrated reliability in various TypeScript environments.

Developers leveraging TypeScript can benefit from TypedJSON to streamline data serialization/deserialization. It's valuable for projects requiring type-safe data handling from external sources or for simplifying complex object modeling. It provides a more robust and type-safe alternative to manual JSON parsing and object creation, particularly when dealing with dynamic JSON data.

Summarize:
Share:
Stars
609
Forks
65
Issues
55
Created
10 years ago
Commit
3 years ago
License
MIT
Archived
No
Updated 1 day ago

Similar Repositories