Articles in this section

JSON Parser Integration in FlowMattic

Updated:

The JSON Parser is a built-in FlowMattic application that provides powerful JSON data manipulation, validation, and transformation capabilities within your workflows. No external connection or API key is required — it works entirely within your WordPress environment.


Overview

JSON (JavaScript Object Notation) is the most common data format used by APIs, webhooks, and web services. The JSON Parser app lets you parse, validate, extract, merge, transform, and export JSON data as part of your automated workflows.


Connection Setup

The JSON Parser is a core utility app — no connection setup is needed.

  • No API key required
  • No external service to configure
  • Available immediately in all FlowMattic installations

Simply select JSON Parser when adding an action step to your workflow.

JSON parser actions.png


Available Actions

The JSON Parser provides 9 actions for working with JSON data:

1. Parse JSON

Parses a JSON string and extracts all keys as individual output fields. Nested objects are automatically flattened using underscore notation.

Input:

Field Required Description
JSON Data Yes The JSON string or data to parse.

Output:

Field Description
status success or error
message Status message
Individual fields Each key in the JSON becomes a separate output field.

How Flattening Works:

Nested JSON structures are flattened with underscores as separators:

// Input
{
  "user": {
    "address": {
      "city": "New York",
      "zip": "10001"
    }
  }
}

// Output fields
user_address_city = "New York"
user_address_zip  = "10001"

This makes it easy to reference deeply nested values in subsequent workflow steps using {JSONParser1.user_address_city}.

json parser - parse json.png


2. Validate JSON

Checks whether a provided string is valid JSON and returns structure details.

Input:

Field Required Description
JSON String Yes The JSON string to validate.

Output:

Field Description
status success or error
is_valid true or false
json_type array, object, or empty
items_count Number of top-level items
error_code PHP JSON error code (if invalid)
message Human-readable validation result

Use Case: Validate JSON received from a webhook or API before processing it, and use a Branch step to handle invalid data gracefully.


3. Stringify JSON

Converts an array or object into a JSON string.

Input:

Field Required Description
Data to Stringify Yes Array, object, or any value to convert to a JSON string.

Output:

Field Description
status success or error
json_string The resulting JSON string

Use Case: Convert workflow data into a JSON string for sending in an HTTP request body or storing in a database.


4. Minify JSON

Removes all whitespace and formatting to produce the smallest possible JSON string.

Input:

Field Required Description
JSON to Minify Yes JSON string to compress.

Output:

Field Description
status success or error
minified_json Compressed JSON output
original_size Size of original JSON in bytes
minified_size Size of minified JSON in bytes
saved_bytes Number of bytes saved

Use Case: Optimize JSON data before storing it in a database or sending it over an API to reduce bandwidth and storage.


5. Prettify JSON

Formats JSON with proper indentation for human readability.

Input:

Field Required Description
JSON to Prettify Yes JSON string to format.

Output:

Field Description
status success or error
prettified_json Formatted JSON with indentation

Use Case: Format JSON for display in emails, logs, or reports where readability matters.


6. Get JSON Value by Path

Extracts a specific value from a JSON structure using dot or slash path notation.

Input:

Field Required Description
JSON Data Yes The JSON object to query.
JSON Path Yes Path to the value you want to extract.

Path Syntax:

Both dot notation and slash notation are supported:

Syntax Example Result
Dot notation user.address.city Value at user → address → city
Slash notation user/address/city Same result
Array index (dot) items.0.name First item’s name field
Array index (slash) items/0/name Same result

Output:

Field Description
status success or error
value The extracted value
path The path that was queried
type Data type of the value (string, integer, array, object, etc.)

Example:

// Input JSON
{
  "order": {
    "items": [
      { "name": "Widget", "price": 9.99 },
      { "name": "Gadget", "price": 19.99 }
    ],
    "total": 29.98
  }
}

// Path: order.items.1.name → "Gadget"
// Path: order.total → 29.98
// Path: order/items/0/price → 9.99

json parser - get value by path.png


7. Merge JSON Objects

Combines two JSON objects into a single object. Values from the second object override the first when keys match.

Input:

Field Required Description
First JSON Yes The base JSON object.
Second JSON Yes The JSON object to merge in (overrides matching keys).

Output:

Field Description
status success or error
merged_json The combined JSON object

Merge Behavior:

  • Uses deep recursive merging — nested objects are merged, not replaced.
  • When the same key exists in both objects, the second object’s value wins.
  • Arrays are preserved as-is (not merged element by element).

Example:

// First JSON
{ "name": "John", "settings": { "theme": "light", "lang": "en" } }

// Second JSON
{ "email": "[email protected]", "settings": { "theme": "dark" } }

// Merged Result
{ "name": "John", "email": "[email protected]", "settings": { "theme": "dark", "lang": "en" } }

Use Case: Merge user-provided data with default values, or combine responses from multiple API calls.


8. JSON to Query String

Converts a JSON object into a URL-encoded query string.

Input:

Field Required Description
JSON Data Yes JSON object to convert.

Output:

Field Description
status success or error
query_string URL-encoded query string

Example:

// Input
{ "name": "John Doe", "city": "New York", "page": 1 }

// Output
name=John+Doe&city=New+York&page=1

Use Case: Build URL parameters for API calls, redirect URLs, or form submissions dynamically within your workflow.


9. Create File from JSON

Saves JSON data as a .json file and uploads it to the WordPress Media Library.

Input:

Field Required Description
JSON Data Yes The JSON data to save as a file.
File Name No Custom file name. Defaults to json-export-{date}.json.

Output:

Field Description
status success or error
message Success or error message
file_url URL to the created file
attachment_id WordPress attachment ID
file_name Actual file name used
file_size File size in bytes
records Number of records in the JSON

File Naming:

  • The .json extension is added automatically if not provided.
  • File names are sanitized using WordPress standards.
  • If a file with the same name exists, a number suffix is appended (e.g., export-1.json, export-2.json).
  • Default naming pattern: json-export-2026-02-17-123456.json

Use Case: Export workflow data as a JSON file for download, email attachment, or archival purposes.

json-parser - create file from json.png


Workflow Examples

Example 1: Parse an API Response

Parse a JSON response from an HTTP request and use individual fields in subsequent steps.

  1. HTTP Request — Call an external API that returns JSON.
  2. JSON Parser > Parse JSON — Parse the response body.
  3. Email — Send an email using {JSONParser1.user_name} and {JSONParser1.user_email}.

Example 2: Validate and Route Data

Validate incoming JSON from a webhook and route the workflow based on validity.

  1. Webhook Trigger — Receive JSON data.
  2. JSON Parser > Validate JSON — Check if the data is valid.
  3. Branch — If {JSONParser1.is_valid} is true, continue processing. Otherwise, send an error notification.

Example 3: Merge and Export

Combine data from multiple sources and export as a file.

  1. HTTP Request — Fetch user data from API.
  2. HTTP Request — Fetch order data from another API.
  3. JSON Parser > Merge JSON — Combine both responses.
  4. JSON Parser > Create File from JSON — Save as a downloadable JSON file.
  5. Email — Send the file URL to the admin.

Example 4: Extract Nested Values

Extract specific values from complex nested JSON structures.

  1. Webhook Trigger — Receive deeply nested JSON.
  2. JSON Parser > Get Value by Path — Extract order.items.0.name.
  3. JSON Parser > Get Value by Path — Extract order.billing.address.city.
  4. WooCommerce — Use extracted values to create an order.

Error Handling

Error Message Action Cause Solution
“Invalid JSON format” Parse JSON, Get Value Malformed JSON string Use Validate JSON first to check the data.
“Path not found in JSON” Get Value by Path Path doesn’t exist in the data Verify the path using Parse JSON to see all available keys.
“Both JSON objects are required” Merge JSON One or both inputs are empty Ensure both fields have valid JSON data.
“Failed to encode JSON data” Create File Encoding issue Validate the JSON data before creating a file.
“Failed to write JSON file” Create File File system permissions Check WordPress uploads directory permissions (should be 755).

Tips

  • Chain multiple JSON Parser actions — You can use Parse JSON, then Get Value by Path, then Stringify in sequence for complex transformations.
  • Use Validate JSON defensively — Before processing JSON from external sources (webhooks, APIs), validate it first and use a Branch to handle invalid data.
  • Dynamic path extraction — The path in “Get Value by Path” supports dynamic variables, so you can use {Trigger1.field_name} as the path itself.
  • File exports for reporting — Use Create File from JSON to generate downloadable reports that can be emailed or stored.

Summary

Feature Details
Connection Required No (built-in core app)
Available Actions 9
Triggers None
Input Formats JSON strings, arrays, objects
Path Notation Dot (user.name) and slash (user/name)
File Export Creates files in WordPress Media Library
Nested JSON Full support with flattening and path extraction
Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Access denied
Access denied