SimpleT Parse JSON into Key-Value Pairs

SimpleT Parse JSON into Key-Value Pairs enables you to extract data from JSON strings and use it in your Salesforce Flow workflows. This tool converts complex JSON data into simple key-value pairs that Flow can easily work with, eliminating the need for custom code.

What This Tool Does

Primary Functions

  • JSON Parsing: Converts JSON strings into key-value pairs
  • Selective Extraction: Extract only the JSON fields you need
  • Error Handling: Gracefully handles invalid or malformed JSON

When to Use This Tool

  • API Responses: Process JSON responses from web service callouts
  • Webhook Data: Parse incoming webhook payloads
  • Configuration Files: Extract settings from JSON configuration data
  • Form Submissions: Process JSON data from web forms

Understanding JSON and Key-Value Pairs

What is JSON?

JSON (JavaScript Object Notation) is a format for storing and exchanging data. It looks like this:

{
  "name": "John Smith",
  "age": 30,
  "email": "john@company.com",
  "active": true
}

What are Key-Value Pairs?

This tool converts JSON into simple pairs where:

  • Key: The field name (like "name", "age", "email")
  • Value: The field value (like "John Smith", "30", "john@company.com")

Input Parameters Explained

Required Fields

JSON String
What it is: The JSON text you want to parse
Format: Valid JSON string
Examples:
• From API callout: {!apiResponse}
• From record field: {!$Record.JSON_Data__c}
• From variable: {!jsonVariable}
• Literal JSON: {"name": "John", "status": "active"}

Optional Fields

Keys to Extract
What it is: List of specific JSON keys you want to extract
Format: List of text values
When to use: When you only need specific fields from large JSON
Examples:
• Extract all: Leave empty
• Extract specific: ["name", "email", "status"]
• From variable: {!keysToExtractList}

Benefits of Selective Extraction:
• Faster processing for large JSON
• Cleaner results with only needed data
• Reduced complexity in Flow logic

Understanding the Results

Result Structure

The parser returns a collection of key-value pairs:

parsedResults[0].invocableWrappers[0].key = "name"
parsedResults[0].invocableWrappers[0].value = "John Smith"
parsedResults[0].invocableWrappers[1].key = "age"  
parsedResults[0].invocableWrappers[1].value = "30"

Accessing Results in Flow

Method 1: Loop Through All Results
Element: Loop
Collection: {!parsedResults[0].invocableWrappers}
Current Item: {!currentKeyValue}

In Loop:
- Key: {!currentKeyValue.key}
- Value: {!currentKeyValue.value}
Method 2: Find Specific Values
Element: Loop
Collection: {!parsedResults[0].invocableWrappers}
Current Item: {!currentKeyValue}

Decision: Find Specific Key
- Condition: {!currentKeyValue.key} Equals "email"
- True Path: Store {!currentKeyValue.value} in emailVariable
Example of using the JSON Parser in Flow Builder.

Practical Examples

Example 1: Processing API Response

Scenario: Get customer information from external API

Flow Setup:
Step 1: HTTP Callout
• Method: GET
• URL: https://api.example.com/customers/123
• Store Response: {!apiResponse}

Step 2: Parse JSON Response
• Action: SimpleT Parse JSON into Key-Value Pairs
• JSON String: {!apiResponse}
• Keys to Extract: ["name", "email", "phone", "status"]
• Store Output: {!parsedCustomer}

Step 3: Extract Customer Data
Loop Through: {!parsedCustomer[0].invocableWrappers}
Current Item: {!currentData}

Decision: Map Fields
• If key = "name": Set customerName = value
• If key = "email": Set customerEmail = value
• If key = "phone": Set customerPhone = value
• If key = "status": Set customerStatus = value

Example 2: Processing Webhook Data

Scenario: Handle order updates from e-commerce platform

Flow Setup:
Step 1: Receive Webhook
• Trigger: Platform Event
• JSON Payload: {!$Record.JSON_Payload__c}

Step 2: Parse Order Data
• Action: SimpleT Parse JSON into Key-Value Pairs
• JSON String: {!$Record.JSON_Payload__c}
• Keys to Extract: ["order_id", "status", "total", "customer_email"]
• Store Output: {!orderData}

Step 3: Process Order Information
Variables to Create: orderId, orderStatus, orderTotal, customerEmail

Assignment Based on Key:
• order_id → orderId
• status → orderStatus
• total → orderTotal
• customer_email → customerEmail

Example 3: Dynamic Form Processing

Scenario: Process form submissions with varying fields

Flow Setup:
Step 1: Form Submission
• Trigger: Record Created (Form_Submission__c)
• JSON Data: {!$Record.Form_Data__c}

Step 2: Parse All Form Fields
• Action: SimpleT Parse JSON into Key-Value Pairs
• JSON String: {!$Record.Form_Data__c}
• Keys to Extract: (leave empty to get all fields)
• Store Output: {!formFields}

Step 3: Process Form Fields Dynamically
For Each Field:
• Create Form_Field__c record
• Field_Name__c = {!currentField.key}
• Field_Value__c = {!currentField.value}
• Form_Submission__c = {!$Record.Id}

Example 4: Configuration Management

Scenario: Load settings from JSON configuration

Flow Setup:
Step 1: Load Configuration
• Get Records: Configuration__c where Active__c = true
• Configuration JSON: {!configRecord.JSON_Settings__c}

Step 2: Parse Configuration
• Action: SimpleT Parse JSON into Key-Value Pairs
• JSON String: {!configRecord.JSON_Settings__c}
• Keys to Extract: ["email_enabled", "max_retries", "timeout_minutes", "debug_mode"]
• Store Output: {!configSettings}

Step 3: Apply Settings
Decision: Apply Each Setting
• email_enabled → Update Email Service settings
• max_retries → Set retry logic parameters
• timeout_minutes → Configure timeout values
• debug_mode → Enable/disable debug logging

Best Practices

Preparing JSON for Better Processing

Use Clear Structure: Ensure your JSON has a logical, organized structure that's easy to understand
Descriptive Key Names: Use meaningful field names that clearly indicate what the data represents
Complete Information: Include all the data fields that your Flow will need to process
Consistent Format: Keep JSON structure consistent across similar data sources for reliable processing

Troubleshooting Guide

Parser Not Working
1. Check JSON Format: Verify JSON is valid using online validators
2. Test with Simple JSON: Start with basic JSON to isolate issues
3. Review Variables: Ensure JSON variable contains expected data
4. Check Permissions: Verify user has access to Flow and action

No Results Returned
1. Empty JSON: Check if JSON string is empty or null
2. Wrong Keys: Verify key names match JSON structure exactly
3. Case Sensitivity: Ensure key names match case in JSON
4. JSON Structure: Confirm JSON is object format, not array

Incorrect Values
1. Data Type Conversion: All values converted to text - verify format
2. Nested Objects: Complex objects become text representations
3. Array Handling: Arrays converted to text format
4. Null Values: Check how null JSON values are handled