Serialization
Edit this pageSolidStart 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:
import { defineConfig } from "@solidjs/start/config";
export default defineConfig({ serialization: { mode: "js", },});import { defineConfig } from "vite";import { solidStart } from "@solidjs/start";
export default defineConfig({ plugins: [ solidStart({ serialization: { mode: "json", }, }), ],});See the full config reference in defineConfig.
Modes
json: UsesJSON.parseon the client. Best for strict CSP because it avoidseval. Payloads can be slightly larger.js: Uses Seroval's JS serializer for smaller payloads and better performance, but it requiresunsafe-evalin 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,EventFormData,Headers,ReadableStreamRequest,ResponseURL,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
RegExpis disabled by default.- JSON mode enforces a maximum serialization depth of 64. If you exceed this, flatten the structure or return a simpler payload.
Related guidance
- Configure modes and defaults in
defineConfig. - CSP implications and nonce examples live in the Security guide.