Extract value from JSON by path
The Extract value from JSON robot parses a JSON string and returns the value at a dot-notation path, e.g. data.user.email or items.0.name. It takes the JSON and the path and returns the value as a string, objects and arrays as JSON, and a Path found flag (Y/N). Works in Bitrix24 (Alaio) business processes and robots.
The robot parses a JSON string and extracts the value at a dot-notation path: object keys and numeric array indexes, for example data.result.0.id. Typical cases: pull the needed field from the response of the HTTP request robot or from JSON sent by an external system into a deal field. It returns the value as a string, objects and arrays as JSON for further parsing, plus a Path found flag (Y/N). If the JSON is invalid or the path is missing, the robot returns N — build a condition on it in the workflow designer to handle the error in a separate branch. Use the result in CRM fields or pass it to the next robots of the business process.
What input parameters does the robot accept?
| Parameter | Type | Required? | Default |
|---|---|---|---|
| JSON string | string | yes | |
| Dot-notation path (e.g. data.result.0.id) | string | yes |
What does the robot return?
| Parameter | Type |
|---|---|
| Extracted value (string) | string |
| Extracted value (JSON, if object/array) | string |
| Path found (Y/N) | string |
Scenario: get a customer email from an external API response
- The HTTP request robot receives a JSON response from an external system
- The robot extracts the value at the path data.user.email
- If the path is found, the email is written to a contact field
Related robots
Related articles
- Zapier and Bitrix24: when you need a connector and when you do not
- Webhooks in Bitrix24: inbound, outbound and reliable delivery
- Workflow variables in Bitrix24: types, substitution and processing
- Field IDs in Bitrix24: how to find a field code and why you need it
- JSON in Bitrix24 business processes: parse a response and build a request
- PHP in Bitrix24 business processes: where it works and what replaces it
- Lists in Bitrix24: registries, business processes, and the limits of their use