joelvh / json2json

Transform (reformat) JSON structures from one to another using JavaScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Path as an array

fabianTMC opened this issue · comments

I have an object similar to this:

{
    "1": [
        {"a": "valueA", "b": "valueB"},
        {"a": "valueC", "b": "valueD"},
    ],
    "2": [
        {"a": "valueE", "b": "valueF"},
        {"a": "valueG", "b": "valueH"},
    ]
}

I want to apply a transformation across all arrays of each key in the object in a similar manner. Using path, I can pick up on each key individually and transform as needed but I am having issues applying the same across all other keys in the object.

Is there a way to provide an array of paths like so:
path: ["1", "2"]

Or is there another way to do this?