Convert From JSON - Synthreo Builder
Convert From JSON node for Builder - parse a JSON string into a Python dictionary or structured object, making individual fields from API responses accessible to downstream nodes.
Purpose
Section titled “Purpose”The ConvertFromJSON node parses a JSON string and converts it into a stringified Python dictionary. The result can be stored, logged, or passed to downstream nodes that handle Python-style string data rather than raw JSON.
This node is most useful in workflows where a downstream step, script, or integration expects data in Python dictionary string format rather than native JSON. It is commonly used when feeding API response data into a Custom Script node that processes the data with Python logic.
Inputs
Section titled “Inputs”- JSON Input - A valid JSON object or array provided as a string from a previous node.
Outputs
Section titled “Outputs”- A single output containing the parsed JSON represented as a stringified Python dictionary.
The conversion follows these rules:
- JSON
nullbecomes PythonNone - JSON
true/falsebecome PythonTrue/False - JSON strings, numbers, arrays, and nested objects are preserved in their Python equivalents
Example:
Input: {"name": "Alice", "age": 32, "active": true, "address": null}Output: "{'name': 'Alice', 'age': 32, 'active': True, 'address': None}"Parameters
Section titled “Parameters”This node has no configurable parameters. It accepts a JSON string on its input connection and produces a stringified Python dictionary on its output connection. No additional configuration is required.
How It Works
Section titled “How It Works”When the node executes, it receives a JSON-formatted string from the previous node. It parses the string using a JSON parser and then serializes the resulting data structure using Python dictionary notation. The key difference from standard JSON is the representation of boolean and null values: JSON uses lowercase true, false, and null, while Python uses True, False, and None. The output is a string, not a live Python object - downstream nodes that receive this value will treat it as a string unless they explicitly evaluate or parse it further.
When to Use This Node
Section titled “When to Use This Node”Use this node only when a downstream step requires Python dictionary string format specifically. Most Synthreo Builder nodes work directly with JSON and do not require this conversion. Common scenarios where this node is appropriate include:
- Passing structured data into a Custom Script node that performs Python-based processing and expects Python-style dict strings as input.
- Logging or storing API responses in a format compatible with Python-based logging systems or databases.
- Debugging complex nested JSON structures by converting them to Python format for easier inspection in workflow test outputs.
If the downstream node accepts JSON directly, skip this node and connect nodes without it.
Step-by-Step (Quick Start)
Section titled “Step-by-Step (Quick Start)”- Add ConvertFromJSON to your workflow.
- Connect a node that outputs a JSON text string to the input of this node.
- Connect the output of this node to the downstream node that requires Python dictionary string format.
- Run the workflow to confirm the output is a stringified Python dictionary.
- Verify that downstream nodes or scripts accept the string output format.
- Save and deploy.
Example Usage
Section titled “Example Usage”Feeding API Response Data into a Custom Script
Section titled “Feeding API Response Data into a Custom Script”A workflow calls an external REST API and receives a JSON response. The response is converted to Python dictionary format before being processed by a Custom Script node.
Upstream output (JSON string):
{"order_id": "ORD-001", "total": 149.99, "paid": true, "notes": null}ConvertFromJSON output:
"{'order_id': 'ORD-001', 'total': 149.99, 'paid': True, 'notes': None}"The Custom Script node receives this string and can evaluate or manipulate it using Python string-to-dict parsing (ast.literal_eval) before applying business logic.
Logging Structured Data
Section titled “Logging Structured Data”A workflow logs API responses to a monitoring system that expects Python dictionary strings. The node converts each JSON response before the log write step.
Best Practices
Section titled “Best Practices”- Ensure valid JSON input: Invalid or malformed JSON will cause this node to return an error. Add input validation or error handling upstream if the JSON source is not guaranteed to be well-formed.
- Use only when needed: Most Synthreo Builder nodes accept JSON directly. Use this node only when a downstream step specifically requires Python dictionary string format, such as a Custom Script node that expects Python-style data.
- Validate downstream compatibility: Confirm that receiving nodes expect a string value. If a downstream node expects a parsed object or native JSON, do not use this node - connect the JSON source directly.
- Understand the output type: The output of this node is always a string. It is not a live Python object. If downstream Python code needs to work with the data as a dictionary, it must parse the string (e.g., using
ast.literal_eval).
Troubleshooting
Section titled “Troubleshooting”Error: invalid JSON format
Section titled “Error: invalid JSON format”The input string is not valid JSON. Common causes include single quotes instead of double quotes, trailing commas, unquoted keys, or incomplete strings from truncated upstream output. Inspect the output of the preceding node and confirm it produces valid JSON before connecting to this node.
Output looks identical to input
Section titled “Output looks identical to input”If the JSON contains only strings and numbers (no booleans or nulls), the Python dictionary representation will appear nearly identical to the JSON string. This is expected behavior. The difference becomes visible when the JSON contains true, false, or null values.
Downstream node does not recognize the output
Section titled “Downstream node does not recognize the output”If the downstream node expects a JSON object rather than a string, use the JSON source directly without this node. This node is designed for the specific case where Python dictionary string format is required.
Test Cases
Section titled “Test Cases”- Given:
{ "name": "Alice", "age": 32, "husband": null }- Expected:"{'name': 'Alice', 'age': 32, 'husband': None}" - Given:
[1, 2, 3]- Expected:"[1, 2, 3]" - Given:
{"active": true, "disabled": false}- Expected:"{'active': True, 'disabled': False}" - Given: Invalid JSON string - Expected: Error indicating invalid JSON format.
Related Nodes
Section titled “Related Nodes”- ConvertToJSON - Transforms workflow data into JSON format, complementary to this node.
- Custom Script - A common downstream consumer of the Python dictionary string output produced by this node.
- Set Transformation - Can filter and reshape JSON data before it is converted by this node.