Having the following input json:
{
"familyMembers": [
{
"name": "Richard",
"living": "Yes"
},
{
"name": "Napoleon",
"living": "No"
}
]
}
the goal is to change "living": "Yes"
to "living": "true"
, so that desired output would be like this:
{
"familyMembers" : [
{
"firstName" : "Richard",
"living": "true"
},
{
"firstName" : "Napoleon",
"living": "false"
}
]
}
The following spec does not produce a desired output:
[
{
"operation": "shift",
"spec": {
"familyMembers": {
"*": {
"name": "familyMembers[&1].firstName",
"living": {
"Yes": {
"#true": "familyMembers[&1].living"
},
"*": {
"#false": "familyMembers[&1].living"
}
}
}
}
}
}
]
The living
field is not included.
If the familyMember
is changed from an array to a map, then the living
field is included in the output with the expected value like in this example: