The difficult example: two independent child arrays
There are two items but two payments. Pairing each item with each payment would create four rows with relationships the source never asserted. jsonnorm creates rows from one array and keeps the other as JSON.
Input JSON
[{
"orderId": 42,
"items": [{ "sku": "S1", "qty": 2 }, { "sku": "S2", "qty": 1 }],
"payments": [{ "method": "card", "amount": 19.99 }, { "method": "coupon", "amount": 5.00 }]
}]Resulting CSV (items exploded)
orderId,items.sku,items.qty,payments
42,S1,2,"[{""method"":""card"",""amount"":19.99},{""method"":""coupon"",""amount"":5.00}]"
42,S2,1,"[{""method"":""card"",""amount"":19.99},{""method"":""coupon"",""amount"":5.00}]"One array per conversion can create repeated rows. Keep other arrays as JSON or join their values.
How to choose the next normalization step
- Choose one array to create repeated rows.
- Keep an independent array as JSON when its items do not pair by position with the selected array.
- Join primitive values when a single cell is the intended result.
Preview the safe result: /items creates rows and /payments stays as JSON.