bazaarvoice / jolt

JSON to JSON transformation library written in Java.
Apache License 2.0
1.56k stars 329 forks source link

JSON spec as a Map #1034

Open sureshbabuinfo opened 4 years ago

sureshbabuinfo commented 4 years ago

Is there any way I can get which property of input is mapped to the output property as a key value pair. The spec itself has that but it is nested and I need it in a different format. Also I don't care about the values.

For Ex. Input:

{
    "rating": {
        "primary": {
            "value": 3
        },
        "quality": {
            "value": 3
        }
    }
}

Spec:

[
    {
        "operation": "shift",
        "spec": {
            "rating": {
                "primary": {
                    "value": "Rating"
                },
                "*": {
                    "value": "SecondaryRatings.&1.Value"
                }
            }
        }
    }
]

Ouput

{
     "rating.primary.value": "Rating",
     "rating.quality.value": "SecondaryRatings.quality.Value"
}