A way to assert the structure of given JSON.
It looks like this:
var FIXTURE = {
name : 'foo',
value : 'bar',
additional : [ 'prop', 'er', 'ties' ]
};
expect(FIXTURE).to.matchJSON({
'$.name' : 'foo',
'$.value' : 'bar'
});
It uses JSONPath for validating paths. The JSONPath project is well documented
with how to specify path selectors (such as $.children[3].prices[price<30]
).
$ browserify lib/match-json.js -o chai-match-json.js
$ npm install -g karma-cli
$ npm install
$ karma start