cancel
Showing results for 
Search instead for 
Did you mean: 

List to Json object

rveera
New Contributor

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””

image

output should be

{
“RecordID”: “22”,
“FullName”: “Monique Davis”,
“AddressLine1”: “12 N Manning Blvd”
}

4 REPLIES 4

christwr
Contributor III

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)

Thank you Christwr

endor_force
New Contributor III

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")

Thank you Karlsson 😀