---
title: JSON
description: Parse, build, pick from and repair JSON
---

Parse, build, pick from, merge and repair JSON.

## What it does

The JSON node has five operations:

* **Parse** turns JSON text into data the next nodes can use. With **Repair If Needed** on (the default), it first fixes nearly-valid JSON.
* **Stringify** turns data into JSON text, indented when **Pretty Print** is on.
* **Pick by path** reads one value with a dot path, such as `product.offers.price`.
* **Merge** deep-merges **Merge With** into the JSON. Objects are merged key by key; lists and plain values are replaced, and **Merge With** wins on conflicts.
* **Repair** fixes JSON text without parsing it, and reports what it changed.

Repair undoes a fixed set of common mistakes, in this order: a Markdown code fence around the JSON, text before or after it, `//` and `/* */` comments, single quotes, keys without quotes, trailing commas, and a cut-off end. It stops as soon as the text is valid. It never invents values: a cut-off end is closed, and a key whose value never arrived is dropped. Valid JSON is never changed.

## When to use it

* Read an AI model's answer that should be JSON but comes wrapped in a code fence or has a trailing comma.
* Turn JSON-LD from [Get Structured Data](/nodes/extension/getstructureddata/) into fields you can address.
* Build a JSON string for an API body or a file with **Stringify**.
* To keep or drop whole fields of an item, [Edit Fields](/nodes/builtin/datatransformation/editfields/) or [Pick Field](/nodes/builtin/datatransformation/pickfield/) are simpler.

## Inputs and settings

The node finds its input in this order: the **JSON** field (for example `{{ $input.output }}`), then the field named in **Source Field** (dots allowed), then the whole incoming item.

**Repair If Needed** also applies to text given to Stringify, Pick by path and Merge, since that text is parsed first.

## Outputs

* **Parse**: a parsed object becomes the item itself, so you can use `{{ $input.title }}` directly. A list becomes one item per entry. Any other value goes in **Put Result In Field**. When repair was needed, a `_repaired` field lists the fixes.
* **Stringify**: the JSON text, in **Put Result In Field**.
* **Pick by path** and **Merge**: an object result becomes the item; anything else goes in **Put Result In Field**.
* **Repair**: the fixed text in **Put Result In Field**, plus `repaired` (whether anything changed), `steps` (the fixes applied, such as `codeFence` or `trailingCommas`) and `valid` (whether the text now parses).

## Dependencies and credentials

None. This node needs no connection and has no slots for other nodes.

## Example workflow

1. A [Basic LLM Chain](/nodes/builtin/ai/aiagents/basicllmchainnode/) is asked to answer with a JSON object holding `title` and `tags`.
2. **JSON** with **Operation** *Parse*, **JSON** set to the model's answer, and **Repair If Needed** on. A reply wrapped in a code fence still parses.
3. [Notion](/nodes/builtin/integration/notion/) creates a page titled `{{ $input.title }}`.

## Common issues

* **"This is not valid JSON: ... Turn on "Repair If Needed" to try to fix it."** The text is broken and repair is off. Turn **Repair If Needed** on.
* **"This could not be read as JSON even after repair: ..."** The text is more than nearly valid, for example plain prose with no braces. Ask the model for JSON only, or check the field you read.
* **"Path "..." does not exist in this JSON."** Compare **Path** with the real structure. List entries use their number, for example `items.0.name`.
* **"Merge needs something to merge in. Fill in "Merge With"."** Fill in **Merge With**.
* **"Repair works on JSON text. This input is already parsed data."** The input is already data, so there is nothing to repair. Use *Parse* or *Pick by path* instead.

## Related nodes

* [Edit Fields](/nodes/builtin/datatransformation/editfields/): set, rename or remove fields.
* [Pick Field](/nodes/builtin/datatransformation/pickfield/): keep one field of an item.
* [Structured Output Parser](/nodes/builtin/ai/aidependencies/outputparser/structuredoutputparser/): ask an AI node for JSON in a fixed shape.
* [Code](/nodes/builtin/core/code/): for transformations no node covers.