Page tree

Skip to end of metadata
Go to start of metadata

In this section:

Introduction

This tool checks whether JSON requests and responses are well-formed. The tool can also validate JSON payloads against schema definitions. You can use JSON Validators as standalone tools to manually validate JSON, or connect it to tools that send or receive messages in JSON format to verify that the payloads are valid. The tool validates against the RFC 4627 version of the JSON standard. 

Attaching a JSON Validator to Existing Tools

You can attach a JSON Validator tool to test clients or other tools that exchange data in JSON format.

  1. Right-click on a tool and choose Add Output...
  2. Select the traffic option you want to validate and choose JSON Validator.

  3. Click Finish and enable either the Validate against schema or Check well-formedness only option in the Tool Settings section.
  4. If you are validating that the JSON is well-formed, click Save to finish adding your tool. If you are using the tool to validate against a schema, configure the following options and click Save.
    1. Choose a type of service definition. OpenAPI/Swagger, RAML, and JSON Schema are supported.
    2. Provide the URL to the definition file. You can also point to an environment variable using the ${variable-name} syntax if a variable has been defined in the suite. The resolved URL will appear if you point to a variable.

    3. Choose a service definition message. This field will be pre-populated based on theclient it's attached to.      

When the client executes, an error will be reported if one or more of the following conditions apply:

  • JSON payload is malformed
  • JSON is not included in the payload 

Using a Standalone JSON Validator

  1. Right-click on a Test Suite and choose Add New> Test...
  2. Select the type of test you want to validate and choose JSON Validator.
  3. Click Finish and click the Tool Settings tab. 
  4. Enable either the Validate against schema or Check well-formedness only option. 
  5. If you are validating that the JSON is well-formed, proceed to the next step. If you are using the tool to validate against a schema, configure the following options and before proceeding to the next step:
    1. Choose a type of service definition. OpenAPI/Swagger, RAML, and JSON Schema are supported.
    2. Provide the URL to the definition file. You can also point to an environment variable using the ${variable-name} syntax if a variable has been defined in the suite. The resolved URL will appear if you point to a variable.
    3. Choose a service definition message.
  6. Click the Input tab and either choose the Text or File option to specify the incoming payload. 
  7. Save your changes.

When the client executes, an error will be reported if one or more of the following conditions apply:

  • JSON payload is malformed 
  • JSON is not included in the payload 

  • No labels