# Compare JSON Content

The Compare JSON Content action in the Avo Assure is found under the @Generic Element is used to verify the two JSON content from different file path and save the result in the given output variable.&#x20;

### **Syntax**

**Input:** `<Filepath-Original file>;<Filepath-File to Compare>;<selective>(Optional)`

* Selective: It fetches only specific parts of the content that will be stored in the output variable.

**Output:** `<Filepath-File to write output>(Optional)<Dynamic Variable>(Optional);<Dynamic Variable>(Optional)`&#x20;

<figure><img src="/files/IeFLoYYm5w6LcWthnVlJ" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**Note:** The file name should not be too long.
{% endhint %}

### **Usecase/Example**

<figure><img src="/files/SmbXUmPriV2rWmKSo96t" alt=""><figcaption></figcaption></figure>

### **Scenario**

When you need to confirm that the order data displayed in an online shopping app is correct, a “Compare JSON Content” action is used. This process checks whether the JSON data from the order system’s API matches an expected JSON file with accurate details. Each time an order is placed, the Avo Assure runs, immediately identifying any errors, such as incorrect product quantities, prices, or delivery dates. This approach speeds up testing and ensures that users see accurate order information without requiring manual inspections.

### **Input**

Provide the following input to compare the two files, as shown below:

C:\Users\Downloads\run2.json;C:\Users\Downloads\run2.json

**XML Content:**

```
{"menu": {
  "id": "file",
  "value": "File",
  "popup": {
    "menuitem": [
      {"value": "New", "onclick": "CreateNewDoc()"},
      {"value": "Open", "onclick": "OpenDoc()"},
      {"value": "Close", "onclick": "CloseDoc()"}
    ]
  }
}};{"menu": {
  "id": "file",
  "value": "File",
  "popup": {
    "menuitem": [
      {"value": "New", "onclick": "CreateNewDoc()"},
      {"value": "Open", "onclick": "OpenDoc()"},
      {"value": "Close", "onclick": "CloseDoc()"}
    ]
  }
}}
```

### **Expected Result**

It should Display the result as files contents are same.

### **Output**

The result of Compare JSON Content action is stored in the {result} output variable as “True”, which can be utilized for display or other purposes.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.avoautomation.com/avo-assure/actions/generic/xml-and-json-operations/compare-json-content.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
