Skip to content

compileSerializer

function compileSerializer(token: OpaqueSchemaToken): SchemaSerializer

Compiles a fast JSON serializer from a schema token.

The compiled serializer outperforms fast-json-stringify on typical API response shapes because Flare’s schema carries type information (uuid, date, enum, string vs text) that allows the codegen to skip escape scans and use pre-built LUTs wherever the field domain guarantees safety.

Record and discriminated-union descriptors get a SchemaSerializer that delegates to JSON.stringify. Callers see the same shape and behaviour as a compiled one, just without the fast path.

token OpaqueSchemaToken · A schema token produced by schema or model.

returns SchemaSerializer

Learn: Serialization

Last updated: