Data Converter
Convert between various data formats - Base64, Binary, JSON, XML, YAML, CSV, HTML, and more
Actions49
- Base64 Actions
- Binary Actions
- Encoding Actions
- Format Actions
- HTML Actions
- String Actions
Overview
The node converts JSON data into a string format with flexible extraction and formatting options. It supports pretty-printing (indented JSON), compact/minified JSON, extracting a specific field value from the JSON using a path, or formatting the JSON using a user-defined template with placeholders.
This node is useful when you need to transform JSON objects into readable text formats for logging, reporting, notifications, or further text processing. For example:
- Pretty print JSON for human-readable output.
- Extract a single value from nested JSON to use in another workflow step.
- Use a template to generate custom formatted text or HTML snippets based on JSON content.
Properties
| Name | Meaning |
|---|---|
| Input JSON | The JSON data to convert, provided as a string representation of a JSON object. |
| Extraction Mode | How to extract or format the JSON content. Options: - Pretty Print: Format JSON with indentation. - Compact: Minified JSON without whitespace. - Extract Field: Extract a specific field value using a path. - Template: Format using a template with {{field}} placeholders. |
| Field Path | (Shown if Extraction Mode is "Extract Field") Dot notation path to the field to extract, e.g., data.items[0].name. Supports array indices. |
| Template | (Shown if Extraction Mode is "Template") A template string with {{field}} placeholders to format JSON values. Example:<h1>{{title}}</h1>\n<p>{{description}}</p> |
| Indent Size | (Shown if Extraction Mode is "Pretty Print") Number of spaces used for indentation in formatted JSON. Default is 2. |
| Binary Property Name | Name for the output binary property if binary output is enabled (not applicable here). |
Output
The node outputs an array of items where each item contains a json property with the conversion result:
- If Extraction Mode is Pretty Print or Compact, the output
json.resultis a string containing the formatted JSON. - If Extraction Mode is Extract Field, the output
json.resultcontains the extracted field's value (could be any JSON type). - If Extraction Mode is Template, the output
json.resultis the string generated by replacing placeholders in the template with corresponding JSON values.
No binary output is produced for this operation.
Example output JSON structure:
{
"result": "<formatted string or extracted value>"
}
Dependencies
- No external services or API keys are required.
- Uses internal utility functions for JSON formatting and templating.
- No special environment variables or credentials needed.
Troubleshooting
- Invalid JSON input: If the
Input JSONstring is not valid JSON, the node will throw a parsing error. Ensure the JSON is well-formed. - Invalid field path: When using "Extract Field" mode, if the specified
Field Pathdoes not exist in the JSON, the output may beundefinedor cause an error. Verify the path syntax and existence. - Template errors: If the template contains placeholders that do not match any fields in the JSON, those placeholders will remain empty or unresolved. Double-check template syntax and field names.
- Indent size issues: Providing a negative or non-integer
Indent Sizemay cause unexpected formatting results. Use positive integers.
Links and References
- JSON.stringify() MDN Documentation — for understanding pretty vs compact JSON formatting.
- Dot notation for object property access — for field path syntax.
- Handlebars/Mustache style templating — similar concept to the template placeholders used here.