Extract JSON data from a string input
The Extract JSON Block finds and parses the first JSON object or array in the input text. It attempts to locate JSON data between curly braces {}
or square brackets []
and parse it into a JavaScript object.
The input string containing JSON data to be extracted. The block will search for the first valid JSON object or array in this string.
The extracted and parsed JSON data as a JavaScript object. If no valid JSON is found or parsing fails, this output will be control-flow-excluded.
If no valid JSON could be parsed, this output will contain the original input string. If JSON was successfully parsed, this output will be control-flow-excluded.
output
portnoMatch
portoutput
port will be control-flow-excluded and the original input string will be available at the noMatch
portnoMatch
port will be control-flow-excluded and the parsed object will be available at the output
portWhat types of JSON structures can be extracted?
The block can extract both JSON objects (enclosed in curly braces ) and JSON arrays (enclosed in square brackets []). It will find the first occurrence of either structure in the input string.
What happens if there are multiple JSON objects in the input?
The block will only extract the first valid JSON object or array it finds in the input string. Subsequent JSON objects will be ignored.
How does the block handle invalid JSON?
If the block cannot parse valid JSON from the input string, it will output the original string to the noMatch
port and control-flow-exclude the output
port.
Extract JSON data from a string input
The Extract JSON Block finds and parses the first JSON object or array in the input text. It attempts to locate JSON data between curly braces {}
or square brackets []
and parse it into a JavaScript object.
The input string containing JSON data to be extracted. The block will search for the first valid JSON object or array in this string.
The extracted and parsed JSON data as a JavaScript object. If no valid JSON is found or parsing fails, this output will be control-flow-excluded.
If no valid JSON could be parsed, this output will contain the original input string. If JSON was successfully parsed, this output will be control-flow-excluded.
output
portnoMatch
portoutput
port will be control-flow-excluded and the original input string will be available at the noMatch
portnoMatch
port will be control-flow-excluded and the parsed object will be available at the output
portWhat types of JSON structures can be extracted?
The block can extract both JSON objects (enclosed in curly braces ) and JSON arrays (enclosed in square brackets []). It will find the first occurrence of either structure in the input string.
What happens if there are multiple JSON objects in the input?
The block will only extract the first valid JSON object or array it finds in the input string. Subsequent JSON objects will be ignored.
How does the block handle invalid JSON?
If the block cannot parse valid JSON from the input string, it will output the original string to the noMatch
port and control-flow-exclude the output
port.