awesome-repositories.com
Blog
MCP
awesome-repositories.com

Discover the best open-source repositories with AI-powered search.

ExploreCurated searchesOpen-source alternativesSelf-hosted softwareBlogSitemap
ProjectMCP serverAboutHow we rankPress
LegalPrivacyTerms
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
typestack avatar

typestack/class-transformer

0
View on GitHub↗
7,334 stars·520 forks·TypeScript·MIT·18 views

Class Transformer

class-transformer is a TypeScript library that converts plain JavaScript objects into typed class instances and back, using decorators to define transformation rules. It serves as a decorator-based object transformer, JSON deserialization library, and property transformation framework, enabling type-safe serialization and deserialization of class instances.

The library distinguishes itself through comprehensive property filtering and mapping capabilities. It supports excluding properties by default, by prefix, by operation (serialization or deserialization), or by explicit marking, as well as filtering properties by group or version range. Property renaming, stripping extraneous properties, and exposing computed properties from getters or methods are also supported, giving fine-grained control over transformation output.

Beyond basic conversion, class-transformer handles nested object transformation, automatic type conversion to match TypeScript-declared types, and polymorphic type discrimination using discriminator properties. It can transform array and collection elements, apply custom transformation logic, convert date strings to Date objects, and handle method return values. The library also provides deep cloning of class instances and direct serialization to and deserialization from JSON strings.

Documentation covers decorator usage, transformation options, and configuration for all supported features, with examples demonstrating each capability.

Features

  • Decorated Object Mappers - Ships a decorator-based object mapper that converts plain objects to class instances and back.
  • Class Instance to Plain Object Converters - Converts class instances back into plain JavaScript objects for serialization or transmission.
  • Plain Object to Class Instance Converters - Converts plain JavaScript objects into instances of specified classes with full type structure preservation.
  • Operation-Based Property Filters - Omits properties only during serialization or only during deserialization.
  • Prefix-Based Property Filters - Omits all properties whose names start with a given prefix.
  • Decorator-Driven Type Converters - Provides automatic type conversion of property values to match TypeScript-declared types during transformation.
  • Class Instance Serializers - Converts class instances directly into JSON strings for storage or network transfer with decorator-driven rules.
  • Decorator-Driven Property Transformers - Applies custom conversion logic, renaming, and filtering to object properties during serialization or deserialization.
  • Class Instance Deserializers - Parses JSON strings into typed class instances with automatic type conversion and nested object handling.
  • Typed Class Deserializers - Parses JSON strings into typed class instances with automatic type conversion and nested object handling.
  • Nested Data Transformers - Recursively converts nested plain objects into their corresponding class instances using type metadata.
  • Decorator-Driven Serializers - Transforms class instances to plain objects and JSON strings with decorator-driven property mapping and exclusion rules.
  • Collection Element Transformations - Converts elements inside arrays, Sets, and Maps into specified class types during transformation.
  • Property Value Transformers - Runs user-defined functions to modify property values during data conversion between plain objects and class instances.
  • Property Name Mappings - Maps a property to a different name in the transformed output during serialization or deserialization.
  • Group-Based Property Filtering - Includes or excludes properties based on assigned groups during transformation operations.
  • Deep Class Instance Cloning - Provides deep cloning of class instances to create independent copies with preserved nested structures.
  • Date String Parsers - Automatically converts date strings within plain objects into JavaScript Date instances during transformation.
  • Object Property Transformers - Omits specified properties from the transformed output during object-to-class or class-to-object conversion.
  • Opt-In Property Exposure - Omits all class properties from transformation output unless they are explicitly marked for exposure.
  • Polymorphic Type Mapping - Selects the correct subclass constructor for nested objects using a discriminator property during deserialization.
  • Additional Property Filtering - Removes properties from a plain object that are not declared in the target class during transformation.
  • Getter and Method Result Exposure - Includes getter return values or method results in the transformed output during serialization.

Star history

Star history chart for typestack/class-transformerStar history chart for typestack/class-transformer

How this analysis was created: This summary and feature list are AI-generated from collected project material and can contain mistakes. Stars, license and language are imported from GitHub. Inclusion does not mean that we have tested or audited this project. Check the source documentation for any feature you depend on. Learn more on our About page.

AI search

Explore more awesome repositories

Describe what you need in plain English — the AI ranks thousands of curated open-source projects by relevance.

Start searching with AI

Frequently asked questions

What does typestack/class-transformer do?

class-transformer is a TypeScript library that converts plain JavaScript objects into typed class instances and back, using decorators to define transformation rules. It serves as a decorator-based object transformer, JSON deserialization library, and property transformation framework, enabling type-safe serialization and deserialization of class instances.

What are the main features of typestack/class-transformer?

The main features of typestack/class-transformer are: Decorated Object Mappers, Class Instance to Plain Object Converters, Plain Object to Class Instance Converters, Operation-Based Property Filters, Prefix-Based Property Filters, Decorator-Driven Type Converters, Class Instance Serializers, Decorator-Driven Property Transformers.

Which projects share features with typestack/class-transformer?

Projects with overlapping indexed features include: symfony/serializer — This library is a PHP-based serialization framework designed to convert complex object graphs into structured formats… mobxjs/mobx-state-tree — MobX State Tree is a structured, tree-based state management library for JavaScript applications that combines typed… dop251/goja — Goja is a JavaScript engine and ECMAScript compliant interpreter implemented entirely in Go. It serves as an embedded… sebastianbergmann/recursion-context — recursion-context is a set of PHP utilities for traversing and modifying deep data hierarchies. It provides a… rtfeldman/seamless-immutable — This is a JavaScript immutable data library used to create objects and arrays that prevent direct mutation. It serves… alibaba/handyjson — HandyJSON is a Swift JSON serialization library and data mapper. It functions as an object mapper that converts JSON…

Projects sharing features with Class Transformer

These projects share indexed features with Class Transformer. Shared tags can include platform or build tooling; verify the primary use case before treating a result as a replacement.
  • symfony/serializersymfony avatar

    symfony/serializer

    2,547View on GitHub↗

    This library is a PHP-based serialization framework designed to convert complex object graphs into structured formats such as JSON, XML, YAML, and CSV, and to reconstruct those objects from serialized data. It functions as a data transformation tool that maps object properties to array structures, facilitating both application state persistence and the exchange of data between systems. The framework distinguishes itself through a two-stage pipeline that normalizes objects into intermediate structures before encoding them into specific formats. It supports advanced mapping requirements, includ

    PHPcomponentphpsymfony
    View on GitHub↗2,547
  • mobxjs/mobx-state-treemobxjs avatar

    mobxjs/mobx-state-tree

    7,050View on GitHub↗

    MobX State Tree is a structured, tree-based state management library for JavaScript applications that combines typed model definitions with reactive snapshots and patch-based change tracking. It provides a reactive state container with runtime and compile-time type safety, where application state is defined as a tree of typed models with collocated actions, computed views, and lifecycle hooks for predictable state mutations. The library is built around an action-centric mutation model that encapsulates all state changes within named functions that directly modify the tree, supported by genera

    TypeScripthacktoberfestmobxmobx-state-tree
    View on GitHub↗7,050
  • dop251/gojadop251 avatar

    dop251/goja

    6,914View on GitHub↗

    Goja is a JavaScript engine and ECMAScript compliant interpreter implemented entirely in Go. It serves as an embedded scripting engine that allows Go applications to execute JavaScript code and integrate a programmable scripting layer without relying on Cgo or external native dependencies. The project functions as a bridge between Go and JavaScript, enabling bidirectional data exchange and function invocation. It allows Go hosts to expose native structs, slices, and maps as JavaScript objects and arrays, while providing mechanisms to export script values and functions back into native Go type

    Go
    View on GitHub↗6,914
  • sebastianbergmann/recursion-contextsebastianbergmann avatar

    sebastianbergmann/recursion-context

    6,574View on GitHub↗

    recursion-context is a set of PHP utilities for traversing and modifying deep data hierarchies. It provides a recursive variable processor designed to apply transformations across nested arrays and objects while maintaining stability. The project distinguishes itself through a recursion depth controller and reference tracking to prevent infinite loops and memory exhaustion when processing circular data structures. It monitors the level of nesting during traversal to avoid stack overflows. These tools cover hierarchical data transformation and nested data processing, allowing for stateful vis

    PHP
    View on GitHub↗6,574
  • Compare all 30 related projects→