JSON Encoder
Encodes Arrow RecordBatches to JSON or newline-delimited JSON (NDJSON) format.
Configuration
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
codec | string | yes | — | Must be "json" |
as_array | boolean | no | false | If true, output JSON array. If false, output NDJSON. |
Example
sinks:
my_http:
type: http
uri: http://example.com/events
encoding:
codec: json
as_array: false # NDJSON formatOutput Formats
NDJSON (default)
One JSON object per line:
{"timestamp": "2024-01-15T10:30:00Z", "level": "info", "message": "Event 1"}
{"timestamp": "2024-01-15T10:30:01Z", "level": "warn", "message": "Event 2"}JSON Array
Single JSON array containing all objects:
[
{"timestamp": "2024-01-15T10:30:00Z", "level": "info", "message": "Event 1"},
{"timestamp": "2024-01-15T10:30:01Z", "level": "warn", "message": "Event 2"}
]When to Use
- HTTP webhooks - Most APIs accept JSON
- Logging systems - ELK, Splunk, Datadog
- Debugging - Human-readable output
- Message queues - Kafka, SQS with JSON payloads