04-25-2019 11:26 AM
I’m trying to substring the field $studySiteChecklist.checklist.lastUpdateDate but I can get it to keep the same output as the input.
Any ideas?
[{
"country": "a",
"studySiteChecklist": {
"checklist": [{
"lastUpdateDate": "2017-08-27T00:00:00Z",
"commentsIndicator": "0",
"comments": "0",
"yesNoIndicator": "0",
"questionNumber": "0",
"checkListNumer": "0",
"question": "0"
}, {
"lastUpdateDate": "2000-08-27T00:00:00Z",
"commentsIndicator": "0",
"comments": "0",
"yesNoIndicator": "0",
"questionNumber": "0",
"checkListNumer": "0",
"question": "0"
}]
}
}]
Output needed:
[{
"country": "a",
"studySiteChecklist": {
"checklist": [{
"lastUpdateDate": "2017-08-27",
"commentsIndicator": "0",
"comments": "0",
"yesNoIndicator": "0",
"questionNumber": "0",
"checkListNumer": "0",
"question": "0"
}, {
"lastUpdateDate": "2000-08-27",
"commentsIndicator": "0",
"comments": "0",
"yesNoIndicator": "0",
"questionNumber": "0",
"checkListNumer": "0",
"question": "0"
}]
}
}]
04-25-2019 11:36 AM
In a Mapper snap you can set the Mapping Root to the array, which can sometimes make writing expressions easier. Take a look at this example and let me know if it helps.
04-26-2019 04:40 AM
Wow, I never used the pass through with mapping root. I was able to get it to work.
Thank you!
Bill
04-25-2019 01:00 PM
I think @tlikarish suggestion is a good one. Another option would be is to use the map method that is available within an array object. If you want to conditionally update elements in the array you can use the if condition within the update expression of the map method.
04-26-2019 04:45 AM
I have tried mapping already with the following.
jsonPath($, “$studySiteChecklist.checklist[*].lastUpdateDate”).map(x => x.substr(0,10)).toString()
But I got the follwing which is not correct.
Thank you for the suggestion
Bill