JSON Extractor
AI-generatedOverview
This node extracts and parses JSON data from a given input text. It supports extracting JSON by identifying the outermost curly braces, parsing the entire input as JSON, or using a custom regular expression to extract JSON. This is useful for scenarios where JSON data is embedded within larger text blocks, such as logs, messages, or mixed content, and you need to isolate and work with the JSON part specifically.
Use Case Examples
- Extract JSON data embedded in a log message by selecting 'Outer Curly Braces' mode.
- Parse a complete JSON string provided as input using 'Full Text' mode.
- Use a custom regular expression to extract JSON data from a complex text format.
Properties
| Name | Meaning |
|---|---|
| Input Text | The text from which to extract JSON data. |
| Extract Mode | Determines how JSON is extracted from the input text. |
| Regular Expression | Custom regex pattern to extract JSON, used only if 'Regular Expression' mode is selected. |
Output
JSON
extracted- The raw JSON string extracted from the input text.parsed- The parsed JSON object from the extracted string.
Troubleshooting
- If no JSON object is found in the input text when using 'Outer Curly Braces' mode, the node throws an error indicating no JSON was found. Ensure the input text contains valid JSON enclosed in curly braces.
- When using 'Regular Expression' mode, if the regex does not match any part of the input text, an error is thrown. Verify the regex pattern and that it includes a capturing group.
- If the extracted text cannot be parsed as JSON, a parsing error is thrown. Check that the extracted string is valid JSON.
- To handle errors gracefully, enable 'Continue On Fail' to allow the workflow to proceed even if JSON extraction fails for some items.