I have JSONs stored to a string field in BQ in the following manner:
select 12345 some_id, '{"163": {"sign": 1, "14": {"20": {"sign": 0}}, "13": {"28": {"sign": 1}}},"154": {"sign": 1, "12": {"21": {"sign": 1}}}}' as x
I want to export this data to JSON file, but the JSON string is exported as follows:
[
{
"some_id": "12345",
"x": "{\"163\": {\"sign\": 1, \"14\": {\"20\": {\"sign\": 0}}, \"13\": {\"28\": {\"sign\": 1}}},\"154\": {\"sign\": 1, \"12\": {\"21\": {\"sign\": 1}}}}"
}
]
Tried to use the BQ JSON functions, as well as the JS temp function which makes use of stringify that appears in many threads, but non of them considers dynamic JSON keys. Creative (or even simple) solution anyone?