Skip to main content

Decode JSON

Uncontrolled node

Overview​

Parse JSON text into a workflow value.

Decode JSON converts JSON text into an object, list, number, boolean or null value. Use it before accessing fields in a text response or processing items from a JSON file.

It is evaluated when its output is needed, without an event trigger.

Inputs​

InputTypeDescription
jsonDataThe JSON text to parse. Non-text values pass through unchanged.

Outputs​

OutputTypeDescription
outputDataThe decoded value, the unchanged non-text input, or an object with an error field if parsing fails.

Example​

  1. Put {"name":"Ada","active":true} into a Plain Text node.
  2. Connect its output to json.
  3. Connect the decoded output to Get Value's object input.
  4. Set Get Value's path to name to read Ada.

Valid JSON matters​

Use double quotes around property names and text values. Comments, trailing commas, surrounding Markdown code fences and extra explanatory text are not valid JSON.

An empty string is not valid JSON. To represent an empty list, supply []; for an empty object, supply {}. The JSON text null decodes to a null value, not an error.

If the input is already an object or list, no conversion is needed and it is returned unchanged.

For structured AI output, consider AI Write Data, then use Validate Schema when the shape matters. Parsing successfully does not prove that required fields exist.