Spring-like JSON Mapping
& Validation for TypeScript
A lightweight library with ZERO external dependencies. Simplify your data layer with familiar decorators.
Try on the fly
npm install cereale
Why Cereale?
Blazing Fast
Zero overhead. Only uses decorators and metadata to handle mapping and validation.
Integrated Validation
Validate while you map. Ensure your data is correct before it even hits your business logic.
Polymorphism
Native support for complex hierarchies. Map to the right subclass automatically based on a discriminator.
Interactive Playground
Edit the code below and see the result in real-time.
TypeScript / Cereale
Output
Available Decorators
Mapping
@JsonSerialize(cls)@JsonDeserialize(cls)@JsonType(() => cls)@JsonPolymorphic(field, types)
Basic Validation
@IsString(),@IsNumber()@IsInt(),@IsBoolean()@IsDate(),@IsObject()@IsNotEmpty(),@IsDefined()@Positive(),@Negative()
Advanced Validation
@Min(n),@Max(n)@MinLength(n),@MaxLength(n)@Email(),@IsUrl()@ValidateNested()