JSON: To String¶
Converts any input data into a JSON-formatted string. Supports pretty (indented) or compact output and handles common Python types like dicts, lists, numbers, booleans, and nulls.

Usage¶
Use this node when you need a clean JSON string from data produced elsewhere in your workflow—such as preparing payloads for APIs, logging structured output, or storing configuration/results as text. Toggle Pretty for human-readable formatting or disable it for compact single-line output.
Inputs¶
| Field | Required | Type | Description | Example | 
|---|---|---|---|---|
| input | True | WILDCARD | The data to convert to JSON. Accepts objects, arrays, numbers, booleans, null, or strings. | {'user': {'id': 123, 'name': 'Ada'}, 'active': True} | 
| pretty | True | BOOLEAN | If true, formats the JSON with indentation for readability; if false, produces compact JSON. | True | 
Outputs¶
| Field | Type | Description | Example | 
|---|---|---|---|
| json_string | STRING | The JSON-formatted string representation of the input. | { "user": { "id": 123, "name": "Ada" }, "active": true } | 
Important Notes¶
- Strings as input: If the input is already a string, the output will be a valid JSON string with quotes (e.g., input hello becomes "hello").
- Fallback on errors: If serialization fails, the node returns the input's plain string representation, which may not be valid JSON.
- Compact vs pretty: Set Pretty to false for compact single-line JSON when minimizing size matters (e.g., API payloads).
- Type handling: Common data types are serialized to JSON equivalents; values not naturally JSON-serializable are converted to their string form.
Troubleshooting¶
- Output is not valid JSON: Ensure the input is JSON-serializable. If errors occurred, the node may have fallen back to a plain string; validate with a JSON validator.
- Unexpected quotes around output: This occurs when the input is a raw string. If you already have JSON text and don't want it re-quoted, parse it first, then convert.
- Missing indentation: Set Pretty to true to enable multi-line, indented formatting.
- Unicode characters escaped unexpectedly: Check downstream consumers; this node preserves non-ASCII characters in the output, but other steps might alter encoding.