Convert JSONs to Table
Converts a specified non-empty JSON array of objects (or single object) into a table.
Overview
Converts a specified non-empty JSON array of objects (or single object) into a table. This is a specialized conversion procedure for JSON data that explicitly creates tables from JSON arrays.
Syntax
convert the jsons to a table
Parameters
jsons (required): A JSON array of objects or a single JSON object to be converted into a table.
Returns
A table where:
Each object in the array becomes a row
Object keys become column names
Object values become cell values
Examples
1. Convert Simple JSON Array to Table
the foos is "[ { \"a\": 1, \"b\": 2 }, { \"a\": 10, \"b\": 20 } ]"
the foos is a json
convert the foos to a table
Result: Table with columns "a" and "b"
1
2
10
20
2. Convert JSON with Nested Objects
the foos is [
{"name": "Obj 0", "val": {"bar": "baz"}, "arr": [0, 1, 2]},
{"name": "Obj 1", "val": {"bar": "busy"}, "arr": [1, 2, 3]},
{"name": "Obj 2", "val": {"bar": "booze"}, "arr": [2, 3, 4]}
]
the foos is a json
convert the foos to a table
Result: Table preserving nested structures
Obj 0
{"bar": "baz"}
[0, 1, 2]
Obj 1
{"bar": "busy"}
[1, 2, 3]
Obj 2
{"bar": "booze"}
[2, 3, 4]
3. Round-Trip Conversion
the foos is [
{"name": "Obj 0", "val": "val 0"},
{"name": "Obj 1", "val": "val 1"},
{"name": "Obj 2", "val": "val 2"}
]
convert the foos to a table
convert the table to a json
Result: Original JSON structure preserved
4. Single JSON Object
the person is {"name": "Alice", "age": 30, "city": "NYC"}
convert the person to a table
Result: Single-row table
Alice
30
NYC
5. Complex JSON from External Source
the results are [
{
"Customer": "TTX Company Inc. Chicago - IL EDI-WHL",
"Shop Name": "Corporate",
"Invoice Date": "",
"InvoiceId": "",
"Sales ID #": "",
"Current Balance": -9671.33
},
{
"Customer": "TTX Company Inc. Chicago - IL EDI-WHL",
"Shop Name": "Corporate Total",
"Invoice Date": None,
"InvoiceId": None,
"Current Balance": -9671.33
}
]
get the results as a json
convert the results to a table
Result: Table with all fields, None/null values preserved
Last updated
Was this helpful?