且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

JSON中的大查询表提取,是否保留空值?

更新时间:2023-11-30 23:12:10

一种选择是使用 TO_JSON_STRING 函数并将结果下载为CSV,或者使用Python之类的API读取结果.您的查询(使用标准SQL)将如下所示:

One option is to use the TO_JSON_STRING function and download the results as CSV, or use an API like Python to read the results. Your query (using standard SQL) would be something like this:

SELECT TO_JSON_STRING(t) AS json
FROM `project.dataset.table` AS t;

这将为任何空列生成值为 null 的命名字段.

This will produce named fields with values of null for any null columns.