Consider the table:
CREATE TABLE watermelon
(
order_id integer,
sort text,
size integer,
juiciness integer,
sender text,
);
I have an incoming json looking like this:
{
"order_id": 500,
"items": [
{
"sort": "regularMidterranian",
"size": 6,
"juiciness": 85
},
{
"sort": "yellowMexican",
"size": 4,
"juiciness": 90
}
],
"sender": "SantaClara"
}
Is there a way to neatly insert this json into the table in one query, thus creating 2 entries with all fields filled?
Or is it simpler to just modify the json beforehand, extracting JArray adding order_id & sender to all items and then using regular json_populate_record?