Skip to main content
Version: 1

Validate JSON against Schema

  • Category

    • Outbound

    • Inbound

    • JSON

    • Validation

  • Flow Icon

Overview

The Validate JSON against Schema component in Plinqx is designed to ensure the integrity of your data by validating inbound or outbound JSON objects against a predefined JSON schema. This component is essential for maintaining data quality and consistency, especially in complex integration scenarios where adherence to a specific data format is crucial.

Inputs

  1. Payload:

    The JSON string that you wish to validate.

  2. Schema: The JSON schema against which the JSON payload will be validated.

Tip: You can store your schema directly in flows as a plain text template or as a string variable when retrieving it from an SObject.

Outputs

  1. Errors:

    A collection of strings detailing any errors encountered during the validation process.

  2. Success:

    A Boolean value indicating the success of the validation. It returns True if the JSON is successfully validated against the schema, or False if it fails the validation.

Example Scenario - Ensuring API Data Compliance

Scenario Overview:

A Salesforce org regularly receives customer data from an external system via API. To ensure the data is in the correct format and contains all required fields, the org needs to validate each JSON payload against a predetermined schema before processing.

Implementation with Validate JSON against Schema Component:

  1. Flow Setup for API Data Reception:

    • Create a Salesforce flow that is triggered upon the receipt of customer data from the external API.
  2. Adding Validate JSON against Schema Component:

    • Incorporate the Validate JSON against Schema component early in the flow to validate the incoming JSON payload.
  3. Configuring Inputs:

    • 'Payload' is set to the incoming JSON string from the API.

    • 'Schema' is defined as the JSON schema stored in a plain text template within the flow or retrieved from an SObject.

  4. Executing JSON Validation:

    • The flow processes the incoming JSON payload using the component, validating it against the defined schema.
  5. Handling Validation Results:

    • If 'Success' is True, the flow continues to process the validated data.

    • In case of validation failures, the 'Errors' output is used to log the issues and potentially trigger an error handling process or notification.

Results:

Implementing the Validate JSON against Schema component allows the Salesforce org to ensure that all incoming customer data via API adheres to the required data structure and format. This proactive validation step enhances data integrity and reduces the risk of errors in downstream processing.