Skip to content

Parse JSON

Parse and extract values from JSON data using powerful JSONPath expressions.

The Parse JSON action allows you to extract specific values from JSON data using JSONPath expressions. Perfect for handling complex API responses, processing webhook payloads, or extracting nested data from JSON strings.

The JSON string you want to parse. This is typically the response from a webhook action or a property containing JSON data.

Example:

{"user":{"name":"John Doe","email":"john@example.com","age":30}}

Or from a webhook:

{{action_123.rawOutput}}

JSONPath Expression(s) (Required, up to 5)

Section titled “JSONPath Expression(s) (Required, up to 5)”

One or more JSONPath expressions to extract values from the JSON data. You can specify up to 5 different paths to extract multiple values in a single action.

Syntax:

  • name - Simple property access
  • user.name - Nested property access
  • items[0] - Array access by index
  • items[*].name - Get all names from array items
  • $.user.profile.settings - Full JSONPath with $ root

Returns "true" if the JSON was parsed successfully, "false" if parsing failed.

Contains an error message if parsing failed, empty if successful.

value1, value2, value3, value4, value5 (Strings)

Section titled “value1, value2, value3, value4, value5 (Strings)”

The extracted values corresponding to each JSONPath expression you provided. If a path doesn’t exist or fails, the value will be empty.

name → Extract "John Doe"
email → Extract "john@example.com"
age → Extract 30
user.profile.name → Extract nested value
user.profile.location → Extract deep nested value
settings.preferences.theme → Multiple levels deep
users[0] → Get first user object
items[2].name → Get name from third item
prices[0] → Get first price
users[*].email → Get all email addresses
items[*].price → Get all prices

Scenario: You received user data from an API and want to extract name, email, and company.

Input JSON:

{
"success": true,
"data": {
"user": {
"firstName": "John",
"lastName": "Doe",
"email": "john@example.com",
"company": {
"name": "Acme Corp",
"domain": "acme.com"
}
}
}
}

JSONPath Expressions:

  1. data.user.firstName
  2. data.user.email
  3. data.user.company.name
  4. data.user.company.domain

Output:

  • value1: "John"
  • value2: "john@example.com"
  • value3: "Acme Corp"
  • value4: "acme.com"

Use: Update contact properties with these values


Example 2: Extract Items from Shopping Cart

Section titled “Example 2: Extract Items from Shopping Cart”

Scenario: Parse order data to get first item details.

Input JSON:

{
"orderId": "ORD-12345",
"items": [
{
"productId": "PROD-001",
"name": "Widget",
"quantity": 2,
"price": 29.99
},
{
"productId": "PROD-002",
"name": "Gadget",
"quantity": 1,
"price": 49.99
}
],
"total": 109.97
}

JSONPath Expressions:

  1. orderId
  2. items[0].name
  3. items[0].quantity
  4. items[0].price
  5. total

Output:

  • value1: "ORD-12345"
  • value2: "Widget"
  • value3: "2"
  • value4: "29.99"
  • value5: "109.97"

Scenario: Extract company data from Clearbit API response.

Input JSON:

{
"person": {
"name": {
"fullName": "John Doe"
},
"employment": {
"name": "Acme Corporation",
"title": "VP of Sales",
"role": "sales",
"seniority": "executive"
}
}
}

JSONPath Expressions:

  1. person.name.fullName
  2. person.employment.name
  3. person.employment.title
  4. person.employment.role
  5. person.employment.seniority

Output:

  • value1: "John Doe"
  • value2: "Acme Corporation"
  • value3: "VP of Sales"
  • value4: "sales"
  • value5: "executive"

Use: Enrich contact records with professional data


Scenario: Get all product names from an order.

Input JSON:

{
"products": [
{"name": "Laptop", "sku": "LAP-001"},
{"name": "Mouse", "sku": "MOU-001"},
{"name": "Keyboard", "sku": "KEY-001"}
]
}

JSONPath Expression:

  1. products[*].name

Output:

  • value1: "Laptop,Mouse,Keyboard" (returned as comma-separated string)

Scenario: Parse both success and error scenarios from API.

Input JSON (Error):

{
"success": false,
"error": {
"code": "INVALID_EMAIL",
"message": "Email address is invalid"
}
}

JSONPath Expressions:

  1. success
  2. error.code
  3. error.message

Output:

  • success: "true" (JSON parsed successfully)
  • value1: "false" (API returned success: false)
  • value2: "INVALID_EMAIL"
  • value3: "Email address is invalid"

Use: Branch on value1 to handle API errors

  • Test your JSON - Use JSONLint to validate JSON structure
  • Test your paths - Use JSONPath Online Evaluator to verify expressions
  • Handle missing values - Always check if output values are empty before using them
  • Use with Webhook - Combine with Webhook action for API integrations
  • Branch on success - Use if/then branches to handle parse failures
  • Start simple - Begin with top-level properties, then go deeper
  • Extract multiple values - Use all 5 paths to minimize action usage
  • Handle arrays carefully - Remember array indices start at 0
  • Parse URL — Extract URL components; use Parse JSON on its queryParamsJson output to get specific query parameters
  • Webhook — Make API calls and parse the response with Parse JSON