parse

The parse task parses a JSON string and returns a JavaScript object. If a malformed JSON string is passed, an exception is thrown. This task is useful when dealing with JSON-formatted content.

Potential use case

Some systems return an XML payload that contains stringified JSON. The parse task reforms the string into a working JSON object so that the individual data components within the object can be accessed.

Properties

InputTypeDescription
textStringRequired. The JSON string to parse. If the string is malformed, an exception is thrown.
OutputTypeDescription
textObjectObjectThe JSON object returned when the input text is parsed.

Example

The text string to parse is statically set to {"firstName": "John", "lastName": "Smith", "age": 22, "state": "California"}.

parse task with the text variable set to a JSON string

The outgoing textObject variable is:

1{
2 "firstName": "John",
3 "lastName": "Smith",
4 "age": 22,
5 "state": "California"
6}
Outgoing textObject showing the parsed JSON object