Skip to main content

ConvertFromJSON

๐ŸŽฏ Purposeโ€‹

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.


๐Ÿ“ฅ Inputsโ€‹

  • JSON Input โ€” A valid JSON object or array in string form.

๐Ÿ“ค Outputsโ€‹

  • A single output containing the parsed JSON represented as a stringified Python dictionary.
    Example:
    Input โ†’ {"name": "Alice", "age": 32}
    Output โ†’ "{'name': 'Alice', 'age': 32}"

๐Ÿ“˜ Best Practicesโ€‹

  • Ensure Valid JSON: Invalid JSON will return an error.
  • Use Only When Needed: Most nodes prefer JSON directly; use this node only when a Python-compatible string is required.
  • Validate Downstream Compatibility: Confirm that receiving nodes expect a string, not a structured object.

๐Ÿงช 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: Invalid JSON
    Expected: Error: invalid JSON format

๐Ÿ—‚๏ธ Real-World Use Casesโ€‹

  • Logging: Store structured API responses as stringified dicts.
  • Debugging: Inspect complex JSON in workflow logs or test outputs.

โœ… Step-by-Step (Quick Start)โ€‹

  1. Add ConvertFromJSON to your workflow.
  2. Connect a node that outputs JSON text.
  3. Run the workflow to produce a stringified Python dictionary.
  4. Confirm downstream nodes or scripts accept the output format.
  5. Save and deploy.