Compare two JSON and return the result
Because JSON is represented in JavaScript Object Notation, but isn't not the same. While in an object the order of the keys is not important, in a JSON is important.
npm install json-is-equalIf you want to use in the browser (powered by Browserify):
bower install json-is-equal --saveand later link in your HTML:
<script src="bower_components/json-is-equal/dist/json-is-equal.js"></script>var isEqual = require('json-is-equal');
var objt1 = {
foo: 'bar',
hello: 'world'
};
var objt2 = {
hello: 'world',
foo: 'bar'
};
console.log(isEqual(objt1, objt2));
// => falseMIT © Kiko Beats