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 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