JSON Format

    The JSON format allows to read and write JSON data based on an JSON schema. Currently, the JSON schema is derived from table schema.

    In order to use the Json format the following dependencies are required for both projects using a build automation tool (such as Maven or SBT) and SQL Client with SQL JAR bundles.

    1. user_id BIGINT,
    2. item_id BIGINT,
    3. behavior STRING,
    4. ts TIMESTAMP(3)
    5. ) WITH (
    6. 'connector' = 'kafka',
    7. 'topic' = 'user_behavior',
    8. 'properties.bootstrap.servers' = 'localhost:9092',
    9. 'properties.group.id' = 'testGroup',
    10. 'json.fail-on-missing-field' = 'false',
    11. 'json.ignore-parse-errors' = 'true'
    12. )

    Currently, the JSON schema is always derived from table schema. Explicitly defining an JSON schema is not supported yet.

    The following table lists the type mapping from Flink type to JSON type.