Advanced

Serialization

Edit this page

SolidStart serializes server function arguments and return values so they can travel between server and client. It uses Seroval under the hood and streams payloads to keep responses responsive.


Configuration

Configure serialization in your app.config.ts with defineConfig:

See the full config reference in defineConfig.


Modes

  • json: Uses JSON.parse on the client. Best for strict CSP because it avoids eval. Payloads can be slightly larger.
  • js: Uses Seroval's JS serializer for smaller payloads and better performance, but it requires unsafe-eval in CSP.
v2 Breaking Change: Defaults

SolidStart v1 defaults to js for backwards compatibility. SolidStart v2 defaults to json for CSP compatibility.


Supported types (default)

SolidStart enables Seroval plus a default set of web platform plugins. These plugins add support for:

  • AbortSignal, CustomEvent, DOMException, Event
  • FormData, Headers, ReadableStream
  • Request, Response
  • URL, URLSearchParams

Seroval supports additional value types. The compatibility list is broader than what SolidStart enables by default, so treat it as a superset. See the Seroval compatibility docs.


Limits and exclusions

  • RegExp is disabled by default.
  • JSON mode enforces a maximum serialization depth of 64. If you exceed this, flatten the structure or return a simpler payload.

Report an issue with this page