โ01-02-2020 03:07 AM
I have a input as given below, how to convert into Json object.
โactions_values_jsonโ: โโRecordIDโ: โ22โ, โFullNameโ: โMonique Davisโ, โAddressLine1โ: โ12 N Manning Blvdโโ
output should be
{
โRecordIDโ: โ22โ,
โFullNameโ: โMonique Davisโ,
โAddressLine1โ: โ12 N Manning Blvdโ
}
โ01-02-2020 06:03 AM
The JSON parse() and stringify() functions might help.
https://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/1439335/JSON+Functions+and+Properties
Try a mapper snap that does a JSON.parse($actions_values_json)
โ01-02-2020 07:06 AM
Thank you Christwr
โ01-02-2020 06:55 AM
Since the value is a plain string you need to add some extra characters for the parsing to work.
If you just want all the fields out, you can run JSON.parse in a mapper for example
JSON.parse('[{' + $actions_values_json + '}]')
If you want to work with specific objects from the string, it could look like this:
jsonPath(JSON.parse('[{' + $actions_values_json + '}]'), "$[*].AddressLine1")
โ01-02-2020 07:06 AM
Thank you Karlsson ๐