Flatten / Map Nested JSON Between Modules
Problem Map fields from one module's nested JSON output onto the next module's input shape, flattening or reshaping as needed. A mapping spec declares where each destination field pulls its value from in the source.
Input / Output
- Input: a source JSON object (arbitrarily nested) and a mapping spec of destination-path -> source-path.
- Output: a new object in the destination shape, values pulled from the source.
Constraints
- Arbitrary nesting depth.
- Source fields may be missing — must not throw; produce a sensible default or omit the key.
Example
- source
{a:{b:1}}, spec{value: 'a.b'}->{value: 1} - missing path
{value: 'a.x'}->{value: undefined}(or key omitted).
added …