Validate JSON fields
JSON imports can validate a row schema and, separately, typed paths inside a JSON document. Choose the contract that matches the stored value.
Row columns
Before INSERT FORMAT, create destination columns for the row fields. A JSON object field assigned to UInt64, for example, must convert to that declared integer range.
Typed document paths
Use JSON(path Type, ...) when one column stores an object with selected typed paths:
sql
CREATE TABLE typed_json
(
doc JSON(user_id UInt64, details.price Decimal(18, 2))
);
INSERT INTO typed_json VALUES
('{"user_id":7,"details":{"price":"12.50"}}');sql
SELECT doc.user_id, doc.details.price
FROM typed_json
FORMAT csv;text
7,12.50Missing and conflicting fields
A missing or explicit-null declared path uses its type default. Nullable paths remain NULL. An object path whose parent is a conflicting scalar is rejected; undeclared members remain in the document.
See JSON for type-hint declarations and JSON functions for extraction and transformations.