JSON
JSON input and output
Content-Type, Accept, or ?format= is provided,
Conduit automatically parses input as JSON and returns JSON output.
JSON Input
To send JSON to Conduit, set the Content-Type header to
application/json.
POST /v1/books
Content-Type: application/json
{
"title": "Example",
"created_at": "2024-01-01T00:00:00Z"
}
Conduit maps JSON objects directly into schema‑aware rows. Extra fields not present in the schema are preserved and returned in responses.
JSON Output
JSON output is selected when:
?format=jsonis usedAccept: application/jsonis sent- The input format is JSON
- No other format preference is provided
GET /v1/books?format=json
Example response:
[
{
"id": 1,
"title": "Example",
"created_at": "2024-01-01T00:00:00Z"
}
]
JSON Schema Responses
Schema endpoints return JSON describing the table’s columns, types, and metadata.
GET /v1/schema/books?format=json
Example:
{
"columns": [
{ "name": "id", "type": "INTEGER", "pk": true, "autoincrement": true },
{ "name": "title", "type": "TEXT", "nullable": false },
{ "name": "created_at", "type": "TEXT" }
]
}
JSON Error Responses
Conduit returns a consistent JSON error envelope for all error conditions. This structure is identical across all formats (JSON, XML, YAML, TOML, NDJSON, CSV, CBOR).
Example JSON error:
{
"error": {
"title": "Resource Not Found",
"message": "The requested record does not exist.",
"status": 404,
"details": [
"No record with ID 999 exists in table 'books'."
],
"documentation_url": "https://docs.conduit.dev/errors/not-found"
}
}
The fields in the error envelope come directly from the ErrorSpec used by Conduit’s
internal error system.
Format Negotiation
JSON is selected when:
?format=jsonis usedAccept: application/jsonis sent- The input format is JSON
- No other format preference is provided
GET /v1/books?format=json