How would I do the following in BigQuery:
SELECT CAST(JSON '[1, 2]' AS ARRAY<INTEGER>)
Invalid cast from JSON to ARRAY at [1:13]
JSON is so much more difficult to work with than the normal types in BQ!
How would I do the following in BigQuery:
SELECT CAST(JSON '[1, 2]' AS ARRAY<INTEGER>)
Invalid cast from JSON to ARRAY at [1:13]
JSON is so much more difficult to work with than the normal types in BQ!
I hope it can help :
SELECT JSON_EXTRACT_ARRAY ('[1, 2]') AS your_array
In this case, the result is an array as expected
Can you try this?
SELECT JSON_VALUE_ARRAY('[1,2]') AS sample_array;
As mentioned in this documentation, this json function extracts the json value. For more json functions you can access the link provided above.
Output: