JSON_TABLE
Turns a JSON array of objects into a header row plus data rows, ready to spill into the sheet. Columns are the union of every key discovered, in a deterministic order, so the same payload always lands the same way.
Arguments
Worked examples
All three use the same payload in A1.
{
"data": {
"orders": [
{ "id": 8842, "customer": { "name": "Ana Ruiz" }, "tags": ["rush", "gift"], "note": null },
{ "id": 8843, "customer": { "name": "Ben Okafor" }, "tags": [], "refunded": true }
]
}
}
Rules it follows
Column order is stable
Keys appear in the order first encountered while scanning records. A key that only shows up in record 900 is appended at the end, not inserted alphabetically.
Keys containing dots are escaped
A source key like "user.id" will not silently collide with a nested user object. Ambiguous collisions are rejected with a message naming both paths.
Arrays of primitives get one column
Point at ["a","b","c"] and you get a single value column rather than an error.
A single object becomes one row
Point at an object instead of an array and you get a header row plus one data row. Ask for a key/value pair layout explicitly if you prefer it vertical.
Big integers stay text
Anything outside JavaScript's safe integer range is written as text so a 19-digit ID does not quietly lose its last digits.
Limits fail loudly
Exceeding your row or column cap raises an error rather than writing a truncated table you might mistake for the whole dataset.
Errors you might see
Usually a truncated paste or a cell that hit the 50,000-character limit. Wrap the input in JSON_VALID() to find the offending rows.
The path is valid but absent. JSON_KEYS(A1, "data") will show you what is actually there.
Options are parsed strictly on purpose — a typo that silently did nothing would be worse.