json-extract

json-extract sqlite format

天涯浪子 提交于 2020-01-16 19:34:31
问题 I used the following command SELECT json_extract(data,'$.address') FROM data; and output as CSV file. Output in CSV file is enter image description here Field (column) in CSV file is saved as 2 lines for 1 field (column). Eg- "71 CHOA CHU KANG LOOP NORTHVALE" How could I save field(column) as 1 line ? That is I don't want to include new line character in filed(column). Eg- "71 CHOA CHU KANG LOOP NORTHVALE" Thanks. 回答1: Just replace the new line character: select replace(json_extract(data,'$

json-extract sqlite format

瘦欲@ 提交于 2020-01-16 19:34:12
问题 I used the following command SELECT json_extract(data,'$.address') FROM data; and output as CSV file. Output in CSV file is enter image description here Field (column) in CSV file is saved as 2 lines for 1 field (column). Eg- "71 CHOA CHU KANG LOOP NORTHVALE" How could I save field(column) as 1 line ? That is I don't want to include new line character in filed(column). Eg- "71 CHOA CHU KANG LOOP NORTHVALE" Thanks. 回答1: Just replace the new line character: select replace(json_extract(data,'$

Extract keys and values from json string in bigquery where there is no specified key in the json document

两盒软妹~` 提交于 2019-12-11 19:04:16
问题 I have a table in bigquery where I have object and for each object I have some stringified json. In json, an example row look like below: { "ObjectID": "1984931229", "indexed_abstract": "{\"IndexLength\":123,\"InvertedIndex\":{\"Twenty-seven\":[0],\"metastatic\":[1,45],\"breast\":[2],\"adenocarcinoma\":[3],\"patients,\":[4]}}" } where inside the indexed_abstract we have an InvertedIndex which contains some keywords and how many times these keywords appeared in the ObjectID . Now I want to