2020-09-29

Postgres expand JSON with unkown keys

I want to expand a specific row in my table which has a json column with the followingstructure:

 id|column1      |
---|-------------|
id1|{nested json}|
id2|{nested json}|

Structure of nested JSON is as follows:

{"random_key_1":{"
               known_key_1":"value",
               "known_key_2":"value"
              },
"random_key_2":{"
               known_key_1":"value",
               "known_key_2":"value"
              },
...

I want expand a single row into following format:

my_column_name |known_key_1 |known_key2|
---------------|-----------|----------|
random_key_1   |  value    |  values  |
random_key_2   |  value    |  values  |


from Recent Questions - Stack Overflow https://ift.tt/3cDa6Sg
https://ift.tt/eA8V8J

No comments:

Post a Comment