Input Json:
{
"accessIds": [
"2293754",
"6660000"
],
"2293754_ACCESS_comment_isPresent": "false",
"6660000_ACCESS_comment_isPresent": "false",
"ACCESS_comment_2293754": {
"accessId": "2293754",
"commentIsPresent": true,
"textValue": "No problems reported."
}
}
Expected Output:
{
"2293754_ACCESS_comment_isPresent": "true",
"6660000_ACCESS_comment_isPresent": "false",
}
Here only first element of array "2293754" has "ACCESS_comment_2293754.commentIsPresent" so we change it to true. The second element does not have this object at all. So we leave it as it is (false).
You can match the keys of the attributes vs. the keys of the object, and pick the last component as the overriding one, if the shift transformation resulted an array such as
[
{
"operation": "shift",
"spec": {
"*_*_*": { // represents the key of the object
"commentI*": "&(1,3)_&(1,1)_&(1,2)_i&(0,1)"
},
"*_*_*_*": "&" // represents attributes
}
},
{
"operation": "modify-overwrite-beta",
"spec": {
"*": "=lastElement"
}
},
{
"operation": "modify-overwrite-beta",
"spec": {
"*": "=toString" // converts from a boolean if so, as desired
}
}
]