Skip to content

JSON: Validate

Checks whether the provided text is valid JSON. Returns a boolean indicating validity and a companion error message string that is empty when valid and explains the parsing issue when invalid.
Preview

Usage

Use this node to guard workflows that depend on well-formed JSON. Typical patterns include validating API responses before parsing, verifying user-provided configuration, or gating conditional branches that require valid JSON input.

Inputs

FieldRequiredTypeDescriptionExample
json_stringTrueSTRINGThe text to validate as JSON. Multiline input is supported. Accepts any valid JSON type (object, array, string, number, boolean, null).{"name":"Alice","age":30,"skills":["python","sql"]}

Outputs

FieldTypeDescriptionExample
is_validBOOLEANTrue if the input is valid JSON; False otherwise.true
error_messageSTRINGEmpty string when valid; otherwise contains a descriptive parsing error message.Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

Important Notes

  • Syntax-only check: This node validates JSON syntax; it does not enforce schemas or field requirements.
  • All JSON types allowed: Objects, arrays, strings, numbers, booleans, and null are valid if properly formatted.
  • Empty or whitespace-only input is invalid: Such inputs will return is_valid = False with an error message.
  • Error message semantics: When is_valid is True, error_message is an empty string; when False, it contains the parse error.
  • Input must be a string: Ensure the value provided is a textual JSON representation, not a pre-parsed structure.

Troubleshooting

  • Always returns False: Verify the input uses double quotes for keys/strings, has no trailing commas, and is a string. Remove invisible characters (e.g., BOM) or trim whitespace.
  • Unexpected characters error: Check for trailing commas, unescaped quotes, or control characters; escape special characters within strings.
  • Encoding issues: Ensure the input is UTF-8 encoded text if it contains non-ASCII characters.
  • Large JSON inputs: If validation is slow or memory-intensive, reduce the payload size or validate in parts before full processing.