Could I create a VIEW from the JSON data type but have it as a relational structure?
Example:
SELECT *
FROM json_test;
Results
[
{
"name": "Roy",
"Country": "USA",
"hobby": "Swim",
"address": "Church Street",
"sex": "M"
},
{
"name": "Roy",
"Country": "USA",
"hobby": "Cricket",
"address": "Amsterdam",
"sex": "F"
},
{
"name": "Anam",
"country": "Greece",
"hobby": "Polo",
"address": "MG Road",
"sex": "M"
}
]
Then to create the VIEW would be something like (not sure if/how to do this)
CREATE VIEW normalized AS
SELECT name, country, hobby, address, sex
FROM JSON data
Then I could query the view with something like this
SELECT *
FROM normalized
Result set
name | country | hobby | address | sex
------+---------+---------+---------------+----
Roy | USA | Swim | Church Street | M
Roy | USA | Cricket | Amsterdam | F
Anam | Greece | Polo | MG Road | M
(3 rows)