03-06-2024 01:12 PM
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 : ' '
Solved! Go to Solution.
03-06-2024 11:41 PM - edited 03-06-2024 11:58 PM
Hi @sobha353 ,
You can parse the string as JSON using the JSON.parse() function in the mapper snap.
JSON.parse($dataDetails.data)
Hence, you can easily map the data as desired.
Hope this helps!
BR.
Ivica
03-06-2024 11:41 PM - edited 03-06-2024 11:58 PM
Hi @sobha353 ,
You can parse the string as JSON using the JSON.parse() function in the mapper snap.
JSON.parse($dataDetails.data)
Hence, you can easily map the data as desired.
Hope this helps!
BR.
Ivica
03-07-2024 10:42 AM
Thank you @ivicakoteski
This worked perfectly and I am getting the desired result