Skip to content

Validate API Response Format Command: RESPONSE_VALIDATE_STRUCTURE

The Validate API Response Format action checks whether a received JSON response matches an expected JSON structure. If the structures match, the result is stored as true in the specified variable. If there are differences, the variable will contain details of the mismatched elements.

Example: Suppose after making an API request, you receive the following JSON response:

v7_api_automation_res_validate_structure_sample_json
Your expected JSON structure is:

v7_api_automation_res_validate_structure_expected_json_structure

Steps to Configure:

  1. Select RESPONSE_VALIDATE_STRUCTURE from the Action dropdown.
  2. Leave the Screen Name field blank.
  3. In the Element Key field, enter the variable name where the result will be stored (e.g., ValidationResult).
  4. In the Parameters section, enter the expected JSON structure to compare against the API response. For example:

{
“user”: {
“id”: “”,
“name”: “”,
“email”: “”
}
}

  1. Click Save.
Note: While the steps for adding an action command are identical in both views, the display of the steps changes:
v7_api_automation_res_validate_structure_list_view
List View
v7_api_automation_res_validate_structure_grid_view
Grid View

Example Workflow:

The following screenshot illustrates how the Validate API Response Format action is structured within an API test case in HuLoop.

Workflow showing the Validate API Response Format step in an API automation sequence
Workflow showing the Validate API Response Format step in an API automation sequence

Expected Outcome:

  • If the actual API response matches the expected structure, the variable ValidationResult will store true.
  • If there are missing or extra fields, ValidationResult will contain details of the mismatches.
  • This variable can be referenced using ${ValidationResult} in assertions or further validation steps.
Note: Ensure the expected JSON structure accurately represents the response format.

Last updated: Oct 8, 2025
Back To Top