Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pank1999/find-json-difference
Json difference between two objects in proper format
https://github.com/pank1999/find-json-difference
json jvascript package
Last synced: 14 days ago
JSON representation
Json difference between two objects in proper format
- Host: GitHub
- URL: https://github.com/pank1999/find-json-difference
- Owner: pank1999
- Created: 2024-06-01T07:21:50.000Z (7 months ago)
- Default Branch: master
- Last Pushed: 2024-06-08T09:02:03.000Z (7 months ago)
- Last Synced: 2024-12-16T03:35:36.249Z (18 days ago)
- Topics: json, jvascript, package
- Language: TypeScript
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# find-json-difference
Calculates the difference between two JSON objects.```js
const {jsonDiff} = require('find-json-difference');
```or
```ts
import {jsonDiff} from "find-json-difference"
``````js
const json1 = {
name: 'John Doe',
age: 30,
address: {
street: '123 Main St',
city: 'New York',
state: 'NY'
}
};const json2 = {
name: 'John Doe',
age: 35,
address: {
street: '123 Main St',
city: 'Los Angeles',
state: 'CA'
},
occupation: 'Software Engineer'
};const differences = jsonDiff(json1, json2);
console.log(differences);
/* output : {
added: { occupation: 'Software Engineer' },
deleted: {},
edited: { age: [ 30, 35 ], address: [ [Object], [Object] ] }
}*/
```