Skip to content

JSON: Get Value

Extracts a value from JSON data using a dot-separated key path. Works with dicts, lists, or JSON strings and supports numeric indices for arrays (e.g., items.0). If the path cannot be resolved, it returns a supplied default value.
Preview

Usage

Use this node when you need to read a specific field or nested value from JSON data within a workflow. Typical usage includes pulling a property from an API response, selecting a list item by index, or safely retrieving deeply nested values with a fallback default.

Inputs

FieldRequiredTypeDescriptionExample
json_dataTrueWILDCARDThe JSON source to read from. Accepts a Python dict, list, or a JSON-formatted string.{"user": {"name": "Ada", "id": 123}, "items": [{"title": "First"}]}
key_pathTrueSTRINGDot-separated path to the target value. Use dots to traverse objects and numeric segments to index lists.items.0.title
default_valueFalseWILDCARDValue to return if the path does not exist, resolves to None, or an error occurs.Not found

Outputs

FieldTypeDescriptionExample
valueWILDCARDThe value found at the specified key path. If not found or an error occurs, returns the provided default_value.First

Important Notes

  • Path format: Use dot-separated keys for objects and numeric segments for lists (e.g., "user.name", "items.0.title").
  • Input parsing: If json_data is a string, the node attempts to parse it as JSON before traversal.
  • Empty path behavior: If key_path is empty, the node returns the original json_data unchanged.
  • Missing values: If a key is missing, an index is invalid, the traversal hits a non-container, or a step resolves to None, the node returns default_value.
  • Error handling: On unexpected errors (including invalid JSON strings), the node returns default_value.

Troubleshooting

  • Returned default instead of value: Verify the key_path spelling and structure matches the JSON. Ensure array indices are numeric and within range.
  • Invalid JSON string: If json_data is a string, confirm it is valid JSON. Use a JSON validation tool or a dedicated validator node first.
  • Type mismatch along path: If a segment expects a dict but encounters a list (or vice versa), adjust the path (e.g., add a numeric index for lists).
  • Received entire input back: This happens when key_path is empty. Provide a non-empty path to extract a specific value.
  • Unexpected None: If an intermediate value is None, the node returns default_value. Check your source data or provide a suitable fallback.