JSPM

find-json-difference

1.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 38
  • Score
    100M100P100Q50771F
  • License ISC

Json difference between two objects in proper format

Package Exports

  • find-json-difference
  • find-json-difference/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (find-json-difference) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

find-json-difference

Calculates the difference between two JSON objects.

const {jsonDiff} = require('find-json-difference');

or

import {jsonDiff} from "find-json-difference"
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] ] }
}*/