sobha353
2 years agoNew Contributor
JSON Formatting - Mapping Key and Value
I have a pipeline which reads data from source in JSON format and below is the format of json data retrieved. I am looking to map the values and not getting the desired result since the data is in string. Can anyone help on this please. Kindly advise.
"dataDetails": {
"data": "{"data":[{"First Name":"testfirstname1","Last Name":"testsecondname1","Status":"Active"},{"First Name":"testfirstname2","Last Name":"testsecondname2","Status":"Active"},{"First Name":"testfirstname3","Last Name":"testsecondname3","Status":"Active"}]}"
Mapper Expression used for mapping one of the above fields after Rest Get snap:
$data.mapValues((val, key) => (key == 'Status') ? val : ' '
Try with this expression:
jsonPath($, "['wd:Academic_Period']['wd:ID'][?(@['@wd:type'] == 'WID')]")