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 :
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.