P粉9669797652023-08-16 10:29:05
要将JSON
列转换为STRING
,您可以使用JSON_EXTRACT_SCALAR
函数。示例:
WITH sample AS ( SELECT JSON '[{"day_of_week": "SUNDAY", "from": "06:00:00", "to": "15:00:00"}]' as json_data ) SELECT JSON_EXTRACT_SCALAR(j.day_of_week) as day_of_week, JSON_EXTRACT_SCALAR(j.from) as `from`, JSON_EXTRACT_SCALAR(j.to) as `to` FROM sample, UNNEST(JSON_EXTRACT_ARRAY(sample.json_data)) j