Open wgu4958 opened 2 years ago
@wgu4958 This expression can implement your requirements, I don't know if it helps you
[{
"operation": "shift",
"spec": {
"items": {
"0": {
"ID": "matchedItem.ID",
"name": "matchedItem.name"
}
}
}
}]
Were you able to resolve this @wgu4958 I am looking solution for exact same use case!
@ouxuyong your solution provided only returns the 0 th index response 🫤 It can be 1/2/3 any ID...
I tried to find a way to find the item in an array by match the value with another field value, but it didn't work, could somebody help on this, thanks
My input Json
{ "request": { "requestID": "1" }, "items": [ { "ID": "1", "name": "item1" }, { "ID": "2", "name": "item2" } ] }
expected output is as below, match the value of request.requesID with the ID value in the list:{ "matchedItem" : { "ID" : "1", "name" : "item1" } }
my spec is, i meant to match the value of the ID to the value of request.requestID (the value is not always 1), but doesn't work as i expected[ { "operation": "shift", "spec": { "items": { "*": { "ID": { "@(4,request.requestID)": { "@(2,ID)": "matchedItem.ID", "@(2,name)": "matchedItem.name" } } } } } } ]