I have json messages that I want to parse and store into relational db tables. The json messages have multiple levels of arrays. For example:
{
"orderid": "123",
"orderdate": "2021-12-23",
"orderlines": [
{
"orderlinenum": 1,
"itemid: "a123",
"itemcost": 10.20
},
{
"orderlinenum": 2,
"itemid: "a999",
"itemcost": 15.23
}
]
}
I want to read this, parse, and store in 2 tables order_header
and order_line
. In this example my order header would have 1 record and I would have 2 order line records. The order lines need to have the order id as well in order to relate the lines to the header.
This is just an simple example. In practice there are multiple arrays, and some arrays have nested arrays. So I don't want to just normalize the whole thing. I really want to read the header level
into a data frame / rdp, then the "line level" into another data frame, etc.