I have a table_1 in PostgreSQL with column_1 and several records in the column containing a nested json with the following structure:
{"parent_1": {
"child_1": [10.477058081076123, 12.570963520289965, 11.74866851427825],
"child_2": [14.174190848828983, 19.3920283059595, 17.6712937162821]
},
"parent_2": {
"child_1_1": [24.100638151071383, 28.544734824158617, 26.83283592992511],
"child_1_2": [14.466083025027984, 34.788137217452125, 19.018732389073737]
} }
I want to convert the json record into another table so that I can import it as a customSQL including the arrays into Tableau.
EDIT 1:
This is the query I am trying:
SELECT * , table_1.column_1 -> 'parent_1' -> json_object_keys((table_1.column1 ->> 'parent_1')::json) FROM public.table_1
EDIT 2:
As an output I would like to get a Table per Parent to be read as such in Tableau. In each table I would like to have:
Table: parent_1
Childs | Value
----------------------------
child_1 | 10.477058081076123
child_1 | 12.570963520289965
child_1 | 11.74866851427825
child_2 | 14.174190848828983
child_2 | 19.3920283059595
child_2 | 17.6712937162821