> For the complete documentation index, see [llms.txt](https://docs.avoautomation.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.avoautomation.com/avo-assure/actions/generic/xml-and-json-operations/compare-json-content.md).

# 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.

### **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)`

<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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
