Skip to main content

JSONDiff

This Script is part of the Common Scripts Pack.#

Supported versions

Supported Cortex XSOAR versions: 6.10.0 and later.

Script to Compare JSON Files and Output Differences#

This script compares two JSON files and returns their differences, such as added, removed, or changed fields, in a structured format.

Script Data#


NameDescription
Script Typepython3
Cortex XSOAR Version6.1.0

Inputs#


Argument NameDescription
old_jsonThe first JSON object to compare.
new_jsonThe second JSON object to compare.

Outputs#


PathDescriptionType
JSONDiff.changedList of fields that have changed between the two JSONs.Array
JSONDiff.addedList of fields that were added in the second JSON.Array
JSONDiff.removedList of fields that were removed from the first JSON.Array

Example#


Input:#

{
"old_json": "{\"a\": 1, \"b\": 2}",
"new_json": "{\"a\": 1, \"b\": 3}"
}