Skip to content

Latest commit

 

History

History
60 lines (40 loc) · 1.13 KB

File metadata and controls

60 lines (40 loc) · 1.13 KB

JSON Validator

Simple JSON Validator through parameters for browser and Node.js.

Installation

Via npm on Node:

npm install json-parameter-parser

Usage

Reference in your program:

var validator = require('json-parameter-parser');

Parse a json

var valid = validator(json, ['parameter1', 'parameter2', 'parameter3.nested']);

If you want a wildcard search in a nested json just type:

var valid = validator(json, ['parameter1.*']);

You can also only test if one particular property is in a JSON.

var valid = validator(json, ['parameter']);

It is as simple as this. Returns true if the JSON has all the given Parameters, false if not.

Development

git clone git://github.com/teuron/json-validator.git
cd json-validator
npm install
npm test

License

MIT

Contribution

Feel free to file issues and submit pull requests contributions are welcome :)

If you submit a pull request, please be sure to add or update corresponding test cases, and ensure that npm test continues to pass.