Socket
Socket
Sign inDemoInstall

json-dup-key-validator

Package Overview
Dependencies
1
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    json-dup-key-validator

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


Version published
Weekly downloads
169K
decreased by-8.98%
Maintainers
1
Install size
30.6 kB
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 06 Feb 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc