Skip to main content

Decode JSON

Uncontrolled node

Overview

Decode JSON parses a JSON string into a usable value such as an object, array, number, boolean, or null. It is the counterpart to the Encode JSON node and is commonly used to convert text from API responses, AI nodes, or files into structured data that other nodes can work with.

Because Decode JSON is uncontrolled it has no run or done events. The workflow evaluates it on demand when another node reads its output.

Pass-through behavior

If the value connected to the Json input is already decoded (i.e. it is not a string), it passes through to the output unchanged. This makes the node idempotent: you can safely place it in a workflow even when you are not sure whether the incoming value is still a JSON string.

Error handling

If the input is a string but is not valid JSON, the node does not fail the workflow. Instead it outputs an error object:

{ "error": "Decode JSON: input is not valid JSON" }

You can check for this shape downstream to handle malformed JSON gracefully.

Inputs

InputTypeDescriptionDefault
JsonDataThe JSON string to parse. Non-string values pass through unchanged.-

Outputs

OutputTypeDescription
OutputDataThe parsed value (object, array, number, boolean, or null). If the input was not a string, the original value is passed through unchanged. If parsing failed, an { error } object is output.

Example

A common use for Decode JSON is turning a JSON text response into an object so you can extract individual fields from it.

  1. Add a Markdown Text node containing a JSON string, for example:
{ "name": "Ada Lovelace", "role": "Engineer" }
  1. Connect the text node's Output to the Decode JSON node's Json input.
  2. Decode JSON outputs a real object: { name: "Ada Lovelace", role: "Engineer" }.
  3. Connect Decode JSON's Output to a Get Value node's Object input, and set the Path to name to extract "Ada Lovelace".
tip

Decode JSON pairs well with AI generation nodes. Ask a model to respond in JSON format, then decode the response and pull out the fields you need with Get Value.