Skip to content

Netuitive/json-dup-key-validator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json-dup-key-validator NPM version Build Status

A json validator that has an option to check for duplicated keys

Install

npm install json-dup-key-validator

Usage

var jsonValidator = require('json-dup-key-validator');

// Returns error or undefined if json is valid
jsonValidator.validate(jsonString, allowDuplicatedKeys);

// Returns the object and throws error if any
jsonValidator.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: 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. Throws error if the json string is not valid.

jsonString

Type: String

JSON string to parse

allowDuplicatedKeys

Type: Boolean

Default: false

Whether duplicated keys are allowed in an object or not

About

A json validator that has an option to check for duplicated keys

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%