Skip to content

JSON: To String

Converts any input data into a JSON-formatted string. Preserves numbers, booleans, lists, and objects; non-JSON-serializable values are coerced to their string representation. The Pretty option controls indentation for human-readable output.
Preview

Usage

Use this node when you need a JSON string representation of data to pass to APIs, store in text fields, or log. Typically follows nodes producing dictionaries/lists and precedes HTTP, file, or database nodes that accept text payloads.

Inputs

FieldRequiredTypeDescriptionExample
inputTrueWILDCARDThe data to convert to a JSON string. Can be a dict/object, list/array, number, boolean, null, or any other value (which will be converted to a string).{'user': {'id': 123, 'name': 'Ada', 'roles': ['admin', 'editor']}}
prettyTrueBOOLEANIf true, formats the JSON with indentation for readability; if false, outputs compact JSON.true

Outputs

FieldTypeDescriptionExample
json_stringSTRINGThe JSON-formatted string representation of the input.{"user":{"id":123,"name":"Ada","roles":["admin","editor"]}}

Important Notes

  • If the input is already a plain string, the output will be a JSON string containing that string (wrapped in quotes), not parsed JSON.
  • Non-serializable objects are converted to their string representation; if you need structured JSON, supply serializable data (dicts, lists, numbers, booleans, null).
  • Pretty formatting adds indentation and increases size; disable it for compact payloads in production or bandwidth-constrained contexts.
  • Unicode characters are preserved (not ASCII-escaped) in the output string.
  • This node does not validate or parse JSON strings; to parse a JSON string into structured data, use JSON: From String.

Troubleshooting

  • Output has unexpected surrounding quotes: This occurs when the input was a plain string. If you intended to parse JSON, use JSON: From String before converting.
  • Output contains escaped characters (e.g., \" inside the text): This is normal for JSON string encoding. When downstream systems parse the JSON, escapes will resolve.
  • Got a simple stringified object representation instead of structured JSON: The input contained non-serializable types. Convert them to dicts/lists or primitives before using this node.
  • Output too large or hard to read: Toggle pretty to false for compact output, or true for readability as needed.