A json handler that has an option to check for duplicated keys
npm install json-duplicate-key-handleA json handler that has an option to check for duplicated keys
npm install json-duplicate-key-handlejs
var jsonHandler = require('json-duplicate-key-handle');// Returns error or undefined if json is valid
jsonHandler.validate(jsonString, allowDuplicatedKeys);
// Returns the object and handle if duplicate key
jsonHandler.parse(jsonString, allowDuplicatedKeys);
`
API
.validate(jsonString, allowDuplicatedKeys)
Validates a json string and returns error if any, undefined if the json string is valid.
#### jsonString
Type: StringJSON string to parse
#### allowDuplicatedKeys
Type:
BooleanDefault:
falseWhether duplicated keys are allowed in an object or not
.parse(jsonString, allowDuplicatedKeys)
Parses a json string and returns the parsed result
#### jsonString
Type: StringJSON string to parse
#### allowDuplicatedKeys
Type:
BooleanDefault:
false`Whether duplicated keys are allowed in an object or not