Multi-Format Engine
Multi-Format Engine
Multi-Format Engine
Conduit decodes input formats (JSON, XML, YAML, TOML, NDJSON, CSV, CBOR) into internal
structures and encodes responses back into the requested format.
Format negotiation is automatic and based on the Content-Type and
Accept headers or the ?format= query parameter.
Input Formats
Conduit supports the following input formats for POST, PUT, and PATCH:
- JSON
- YAML
- TOML
- XML
- NDJSON (streamed objects)
- CSV (header-based mapping)
- CBOR (binary structured data)
The decoder automatically selects the correct parser based on the
Content-Type header.
Unsupported formats return a structured error.
Output Formats
All endpoints support multiple output formats:
- JSON
- YAML
- XML
- TOML
- CSV
- NDJSON
- CBOR
Output format is selected using either the Accept header or the
?format= query parameter.
GET /v1/books?format=xml
GET /v1/books?format=toml
GET /v1/books?format=ndjson
Format Negotiation
Conduit determines the output format using the following priority:
?format=query parameterAcceptheader- Default: JSON
If the requested format is unsupported, Conduit returns a structured error describing the available formats.
NDJSON Streaming
NDJSON (Newline‑Delimited JSON) is ideal for large datasets and streaming pipelines. Conduit outputs one JSON object per line and flushes the response incrementally when supported by the HTTP server.
{"id":1,"title":"Example"}
{"id":2,"title":"Another"}
NDJSON input is also supported for bulk inserts.
CSV
CSV output includes a header row followed by one row per record. Column order is determined by the schema.
id,title,author
1,Foundation,Isaac Asimov
2,Dune,Frank Herbert
CSV input maps header names to column names. Missing columns are ignored; extra columns are ignored.
CBOR
CBOR is a compact binary format ideal for IoT devices and high‑performance clients. Conduit uses a deterministic CBOR encoder to ensure consistent output across requests.
CBOR input is parsed into the same internal structure as JSON, YAML, XML, and TOML.
Internal Model
Regardless of input format, Conduit normalizes all payloads into a unified internal structure. This ensures consistent validation, authorization, and database behavior across formats.
The encoder then converts the internal structure into the requested output format.
Notes
- All formats support schema and CRUD endpoints.
- NDJSON is ideal for streaming large datasets.
- CSV input requires a header row.
- CBOR is recommended for embedded systems.
- Format negotiation is consistent across all endpoints.
- Errors are encoded in the requested format whenever possible.