> 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="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FY3KVljPrYeGUD9fCIRUF%2Fimage.png?alt=media&amp;token=179e2ae5-a35a-4edd-8f6d-a4fa5a31e88e" alt=""><figcaption></figcaption></figure>

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

### **Usecase/Example**

<figure><img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FHiIrJer4PvUodGvO4tGx%2Fimage.png?alt=media&amp;token=3669aaf1-e4bb-4bc8-98bd-8da63888c3e9" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
