Advertisement

JSON to BigQuery Schema

Convert JSON into BigQuery table schemas. Get the JSON field list with STRING, INTEGER, RECORD, and REPEATED modes inferred from your data.

JSON input

Paste JSON, optionally name the root type, then generate.

Your BigQuery schema code will appear here.
Advertisement

Schemas for data warehouse loads

Loading JSON into BigQuery needs an explicit schema for reliable types. This tool converts a representative record into the field list BigQuery expects, with RECORD types for nesting and REPEATED mode for arrays.

Autodetect, but deterministic

BigQuery's schema autodetect guesses from a sample too, but its choices can surprise you. Generating the schema yourself gives you a version controlled definition you can review and reuse across loads.

JSON to BigQuery FAQs

What format is the output?
A JSON array of field definitions with name, type, and mode, which is exactly what bq load and the BigQuery API accept as a table schema.
How are nested objects represented?
Nested objects become type RECORD with their own fields array, which is BigQuery's native way to store structured nested data.
What do NULLABLE and REPEATED mean?
NULLABLE fields may be missing, REPEATED fields are arrays. Fields that were null or absent in the sample become NULLABLE automatically.
Which types are inferred?
Strings become STRING, whole numbers INTEGER, decimals FLOAT, booleans BOOL, and timestamps stay STRING unless you cast them, since formats vary.
How do I use this with bq load?
Save the output as schema.json and pass --schema=schema.json to bq load, or paste it into the console's schema editor when creating a table.
Advertisement