JSON to BigQuery schema
Use the output with bq mk, bq load, or the Edit as text option when creating a table in the console.
Loading the tool…
Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.
How to use it
- Enter json input and mark always-present fields required.
- The result appears straight away and updates as you edit.
- Copy the result, or copy a link that keeps the same values to share it.
How it is calculated
INTEGER, FLOAT, BOOLEAN and STRING, RECORD with fields for objects and REPEATED for arrays. Nested arrays and mixed values become JSON. Invalid names become snake_case, and the mode is NULLABLE by default, or REQUIRED for always-present fields when the option is on.
Example
Inputs: Mark always-present fields REQUIRED = no. Result: Generated code: [ { "name": "id", "type": "INTEGER", "mode": "NULLABLE" }, { "name": "name", "type": "STRING", "mode": "NULLABLE" }, { "name": "email", "type": "STRING", "mode": "NULLABLE" }, { "name": "is_active", "type": "BOOLEAN", "mode": "NULLABLE" }, { "name": "balance", "type": "FLOAT", "mode": "NULLABLE" }, { "name": "tags", "type": "STRING", "mode": "REPEATED" }, { "name": "address", "type": "RECORD", "mode": "NULLABLE", "fields": [ { "name": "city", "type": "STRING", "mode": "NULLABLE" }, { "name": "postal_code", "type": "STRING", "mode": "NULLABLE" } ] }, { "name": "orders", "type": "RECORD", "mode": "REPEATED", "fields": [ { "name": "order_id", "type": "STRING", "mode": "NULLABLE" }, { "name": "total", "type": "FLOAT", "mode": "NULLABLE" }, { "name": "coupon", "type": "STRING", "mode": "NULLABLE" } ] } ]; Types generated: 3; Fields: 13.
{
"id": 1024,
"name": "Sara Ahmed",
"email": "sara@example.com",
"is_active": true,
"balance": 1520.75,
"tags": ["vip", "riyadh"],
"address": { "city": "Riyadh", "postal_code": "12211" },
"orders": [
{ "order_id": "A-1", "total": 99.5, "coupon": "EID10" },
{ "order_id": "A-2", "total": 120, "coupon": null }
]
}[
{
"name": "id",
"type": "INTEGER",
"mode": "NULLABLE"
},
{
"name": "name",
"type": "STRING",
"mode": "NULLABLE"
},
{
"name": "email",
"type": "STRING",
"mode": "NULLABLE"
},
{
"name": "is_active",
"type": "BOOLEAN",
"mode": "NULLABLE"
},
{
"name": "balance",
"type": "FLOAT",
"mode": "NULLABLE"
},
{
"name": "tags",
"type": "STRING",
"mode": "REPEATED"
},
{
"name": "address",
"type": "RECORD",
"mode": "NULLABLE",
"fields": [
{
"name": "city",
"type": "STRING",
"mode": "NULLABLE"
},
{
"name": "postal_code",
"type": "STRING",
"mode": "NULLABLE"
}
]
},
{
"name": "orders",
"type": "RECORD",
"mode": "REPEATED",
"fields": [
{
"name": "order_id",
"type": "STRING",
"mode": "NULLABLE"
},
{
"name": "total",
"type": "FLOAT",
"mode": "NULLABLE"
},
{
"name": "coupon",
"type": "STRING",
"mode": "NULLABLE"
}
]
}
]Limits and caveats
- BigQuery rejects null values inside arrays when loading data.
- BigQuery column names are case-insensitive, so a repeated name gets a number, such as id2.
Questions about this tool
Why NULLABLE by default?
REQUIRED rejects any row missing the field at load time, so NULLABLE is safer with data you have not fully checked.
How do I use it with bq?
Save the output as schema.json, then run bq mk --table dataset.table schema.json.
Is my JSON sent to a server?
No. The conversion runs in your browser and the JSON never leaves your device.
