
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
DeltaJSON is a powerful tool used to accurately compare the differences between two json files. With superior results for unordered array comparison, combined with a JSON output format for ease of use in further transformation of results.
For DeltaJSON to work you will need a token file.
To get this file head to our website to sign up and download your token file. If you already have a subscription head to DeltaJSON App to get your token file.
To install the DeltaJSON package, navigate to your desired location in your terminal, and type the following commands.
npm install deltajson
npm link deltajson
In your development environment, place the token file in the root directory of your project. Make sure you add the filename to your .gitignore file.
echo 'DeltaJSON_Auth.json' >> .gitignore
Import the package in your .js file
import deltajson from 'deltajson'
Once that has been completed, the function deltajson.compare() will be available for you to use. Here is an example of how to use the compare function:
let Result = await deltajson.compare('/Path/to/fileA.json','/Path/to/fileB.json')
Your JSON will be compared and the result can then be further processed as required. Note: the compare function is calling a rest service, you will need to use the "await/async" functions to be able to receive the results.
Now you are ready to configure your comparison using additional parameters which are described below in the Usage section.
The above sample will run a basic comparison. This is an example of the sample running the below code:
deltajson compare node_modules/deltajson/samples/fileA.json node_modules/deltajson/samples/fileB.json result.json
You can replace fileA and fileB with your own files and give it a try.
deltajson compare [/Path/to/your/first/fileA.json] [/Path/to/your/second/fileB.json] [/Path/to/your/results/result.json]
If you want explore DeltaJSON parameters we have provided a sample below.
Download and place the token file in the same folder as the installed node package. This would normally be node_modules/deltajson. When that has been completed you will be able to run the sample.
Navigate in the terminal to the same folder as the installed node package and run this command. This will run a preset sample to give you an example of how the comparison works.
npm run sample
| Parameters | Options | Default |
|---|---|---|
| wordByWord | true/false | false |
| arrayAlignment | Orderless/Type With Value/Position | Orderless |
| dxConfig | ignoreChanges | null |
When using the package in node the following lines will do the default comparison and return a json.
import deltajson from 'deltajson'
let Result = await deltajson.compare('/Path/to/fileA.json','/Path/to/fileB.json')
When using the command line, the following fields are all required and should be typed in in the following order. This will do a comparison with the default parameters set.
deltajson compare fileA.json fileB.json result.json
The parameter wordByWord will give you a more granualar result. This is set to false by default.
let result = await deltajson.compare('fileA.json','fileB.json',{"wordByWord":"true"});
deltajson compare fileA.json fileB.json result.json wordByWord=true
Click here for more information on how wordByWord works.
This parameter gives you control over how items in arrays are matched for comparison. The options for arrayAlignment are as follows:
let result = await deltajson.compare('fileA.json','fileB.json',{"arrayAlignment":"Orderless"});
deltajson compare fileA.json fileB.json result.json arrayAlignment=orderless
let result = await deltajson.compare('fileA.json','fileB.json',{"arrayAlignment":"Orderless"});
deltajson compare fileA.json fileB.json result.json arrayAlignment=typeWithValuePriority
let result = await deltajson.compare('fileA.json','fileB.json',{"arrayAlignment":"positionPriority"});
deltajson compare fileA.json fileB.json result.json arrayAlignment=positionPriority
Click here for more information on how arrayAlignment works.
dxConfig is used for additional transformations of the json file like ignoring changes, for instructions on how to use this setting, go to our documentation
let result = await deltajson.compare('fileA.json','fileB.json',{"dxConfig":"[path/to/dxconfig.json]" or
"dxConfig":"{ \"dxConfig\" : [{ \"ignoreChanges\" : \"delete\",\"key\" : \"hobbies\" }]}"});
deltajson compare fileA.json fileB.json result.json dxConfig=""
FAQs
A powerful JSON comparision tool
We found that deltajson demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.