Created
March 15, 2018 10:06
-
-
Save infinex/7507b8007c608e8443dfa66dd4fb71fb to your computer and use it in GitHub Desktop.
bigquery stringify json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TEMP FUNCTION | |
| cleanup(text | |
| STRING | |
| ) | |
| RETURNS | |
| STRUCT < | |
| key string, | |
| value string> | |
| LANGUAGE js AS """ | |
| return JSON.parse(text); | |
| """; | |
| with a as (SELECT "{\"value\": \"hello\",\"key\": \"bye\"}" as x) | |
| select cleanup(x) from a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment