Parse JSON

Convert JSON strings into structured data

Overview

The Parse JSON utility takes a JSON string and converts it into a structured object that you can work with in your flow. This is essential when receiving data as text from APIs, webhooks, or other sources that return JSON as strings.

Once parsed, you can access individual fields using template syntax like{{#N.data.fieldName}}.

Configuration

JSON String

The JSON string to parse. Usually comes from a previous node.

{{#1.data.responseBody}}

Output

The parsed JSON is returned directly as the output. If the input is an object, all properties become accessible. If it's an array, the array is returned.

Access parsed data:

  • {{#N.fieldName}} - Access a field directly
  • {{#N.nested.field}} - Access nested fields
  • {{#N[0]}} - Access array elements

If parsing fails, the node outputs an error field with details.

Examples

Example 1: Parse API Response

An API returns user data as a JSON string:

Input:
"{"id": 123, "name": "John", "email": "john@example.com"}"
Output:
{
  "id": 123,
  "name": "John",
  "email": "john@example.com"
}

Access with: {{#2.data.name}} returns "John"

Example 2: Parse Nested JSON

Handle complex nested structures:

Input: "{\"user\": {\"profile\": {\"avatar\": \"url.jpg\"}}}"

Access nested values:
{{#2.data.user.profile.avatar}}  →  "url.jpg"

Example 3: Parse Array

Parse a JSON array for iteration:

Input: "[{\"id\": 1}, {\"id\": 2}, {\"id\": 3}]"

[Parse JSON] ──▶ [Array Iterator]
     │                  │
     ▼                  ▼
  [{id:1},          Process each
   {id:2},          item individually
   {id:3}]

Error Handling

If the input is not valid JSON, the node will fail with an error:

{
  "error": "Invalid JSON: Unexpected token at position 5. Input was: ..."
}

The node automatically handles double-quoted JSON strings and escaped newlines.

Tips

Tip: If your data is already a JSON object (not a string), you don't need Parse JSON. Templates work directly on objects.

Tip: Common sources requiring Parse JSON: webhook body text, stored JSON strings in databases, API responses returned as text.

Note: Always validate JSON parsing succeeded before using the data. Invalid JSON will cause downstream nodes to fail.

Parse JSON Utility - Flows Guide - Serenities