The original orders array contains orders 001 and 002, with three items A, B and C. Separate parent and child tables can be restored without a Cartesian product when parent_id and zero-based ordinal stay attached to every child.
Parent
Children
Relationship
001
0:A / 1:B
two items
002
0:C
one item
Split parent and child CSVs
parents.csv carries the order ID and note meaning. children.csv carries parent ID, order, SKU and quantity. If a source has no stable key, keep a documented in-file ID and do not mix it with another document. Store column, JSON path, type and null policy in schema/mapping.json.
parent_id=001 ordinal=0 → A ordinal=1 → B
Keep the parent key with child order.
001.note = null 002.note = "" A blank is not null proof
Use the mapping manifest to distinguish null from empty string.
Change only item B from 3 to 4
edited-children.csv changes only 001 / ordinal 1 / B from qty 3 to qty 4. Parent ID and note, items A and C, and every ordinal stay unchanged. Total quantity moves from 6 to 7.
Row
Before
After
Changed path
001 / 1 / B
qty 3
qty 4
/orders/0/items/1/qty
Everything else
unchanged
unchanged
none
Compare values, types and relationships
expected.json has two orders, three items and total quantity 7. Check ID and quantity types, child order, 001.note=null, 002.note="", and empty child arrays where applicable. Separate formatting or object-key order differences from value, type and path differences.
orders[0].items[1].qty: 3 → 4 parents: 2 / children: 3 / total qty: 7 orders[0].items stays A, B
Do not auto-repair broken relationships
orphan.csv points to missing parent 999; keep it unresolved and do not invent a parent. duplicate-parent.csv repeats order ID 001; do not silently select the first row. Missing ordinals, untyped blanks and relationship drift should block output for review.
The original JSON and CSVs are fixtures for this guide. In real work, preserve the original and compare before and after independently.
Review with the existing JSON/CSV formatter
Keep the source JSON, parent CSV, child CSV and mapping together.
Use the existing JSON/CSV formatter to assign the parent and child tables.
Load the edited child CSV and change only B quantity to 4.
Before saving, check counts, order, types, null, orphan and duplicate boundaries.
Compare the completed JSON with expected.json by path, without sending input outside the browser.