Dependency
Usage with Kafka
Usage with Filesystem
When using JSON with the Filesystem connector, each line in the file must be a complete, valid JSON object (newline-delimited JSON / JSONL). Standard multi-line JSON arrays are not supported for filesystem writes.Nested types
Map nested JSON objects to FlinkROW types:
Top-level JSON arrays
Flink’s JSON format supports reading top-level JSON arrays. The following two inputs both produce two rows(123, "a") and (456, "b") for a table with columns (col1 BIGINT, col2 VARCHAR):
Format options
| Option | Required | Default | Description |
|---|---|---|---|
format | Yes | — | Must be 'json'. |
json.fail-on-missing-field | No | false | Throw an error if an expected field is missing from the input JSON. |
json.ignore-parse-errors | No | false | Skip rows that fail to parse instead of failing the job. Affected fields are set to null. |
json.timestamp-format.standard | No | 'SQL' | Timestamp format. 'SQL': yyyy-MM-dd HH:mm:ss.s{precision}. 'ISO-8601': yyyy-MM-ddTHH:mm:ss.s{precision}. |
json.map-null-key.mode | No | 'FAIL' | How to handle null map keys during serialization. 'FAIL': throw exception. 'DROP': skip the entry. 'LITERAL': replace with the string specified in json.map-null-key.literal. |
json.map-null-key.literal | No | 'null' | Replacement string when json.map-null-key.mode = 'LITERAL'. |
json.encode.decimal-as-plain-number | No | false | Write decimals as plain numbers instead of scientific notation (e.g., 0.000000027 instead of 2.7E-8). |
json.encode.ignore-null-fields | No | false | Omit null fields from the serialized JSON output. |
decode.json-parser.enabled | No | true | Use the Jackson JsonParser (streaming) API for parsing. Faster and uses less memory than the JsonNode approach. Disable if you encounter compatibility issues. |
Data type mapping
| Flink SQL type | JSON type |
|---|---|
CHAR / VARCHAR / STRING | string |
BOOLEAN | boolean |
BINARY / VARBINARY | string (base64-encoded) |
DECIMAL | number |
TINYINT / SMALLINT / INT / BIGINT | number |
FLOAT / DOUBLE | number |
DATE | string with format date |
TIME | string with format time |
TIMESTAMP | string with format date-time |
TIMESTAMP_WITH_LOCAL_TIME_ZONE | string with format date-time (UTC) |
INTERVAL | number |
ARRAY | array |
MAP / MULTISET | object |
ROW | object |
Timestamp format examples
- SQL format (default)
- ISO-8601 format

