parse (string)
- 10 Feb 2025
-
DarkLight
-
PDF
parse (string)
- Updated on 10 Feb 2025
-
DarkLight
-
PDF
Article summary
Did you find this summary helpful?
Thank you for your feedback
Task Purpose
The parse
task is used to parse a JSON string (written in JSON format) and return a JavaScript (JS) object. If a malformed JSON string is passed, an exception is thrown. This task is very useful when dealing with JSON-formatted content.
Potential Use Case
Some systems will return an XML payload which has stringified json. The parse
task will reform the string into a working JSON object so that the individual components of data within the JS object can be accessed.
Properties
Input and output properties are shown below.
Input | Type | Description |
---|---|---|
text |
String | Required. The JSON string to parse. If the string is malformed (not a valid JSON format), an exception is thrown. |
Output | Type | Description |
---|---|---|
textObject |
Object | The JSON object that returns when the input text is parsed. |
Examples
In the example shown below, the text
string to parse is statically set to {"firstName": "John", "lastName": "Smith", "age": 22, "state": "California"}
.
The outgoing textObject
variable would be:
{
"firstName": "John",
"lastName": "Smith",
"age": 22,
"state": "California"
}
Was this article helpful?