Reputation: 290
I've transforming one jso to another json. All looks fine. Except the below scenario.
Input Json:
{
"v1": 1,
"v2": {
"inv1": {
"Id": 1
},
"inv2": "some text"
}
}
Expected JSON:
{
"value1": 1,
"value2": {
"innervalue1": {
"value": 1
},
"innervalue12": "some text"
}
}
Can someone please help me to write specs for this transformation ?
Upvotes: 0
Views: 235
Reputation: 718
Try this spec:
[
{
"operation": "shift",
"spec": {
"v1": "value1",
"v2":{
"inv1":{
"Id":"value2.innervalue1.value"
},
"inv2":"value2.innervalue12"
}
}
}
]
Output is:
{
"value1" : 1,
"value2" : {
"innervalue1" : {
"value" : 1
},
"innervalue12" : "some text"
}
}
Upvotes: 1