json-dup-key-validator
A json handler that has an option to check for duplicated keys
Install
npm install json-duplicate-key-handle
Usage
var jsonHandler = ; // Returns error or undefined if json is validjsonHandler; // Returns the object and handle if duplicate keyjsonHandler;
API
.validate(jsonString, allowDuplicatedKeys)
Validates a json string and returns error if any, undefined if the json string is valid.
jsonString
Type: String
JSON string to parse
allowDuplicatedKeys
Type: Boolean
Default: false
Whether duplicated keys are allowed in an object or not
.parse(jsonString, allowDuplicatedKeys)
Parses a json string and returns the parsed result
jsonString
Type: String
JSON string to parse
allowDuplicatedKeys
Type: Boolean
Default: false
Whether duplicated keys are allowed in an object or not