Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

json-dup-key-validator

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

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

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
207K
increased by5.24%
Maintainers
1
Weekly downloads
 
Created

What is json-dup-key-validator?

The json-dup-key-validator npm package is used to validate JSON objects for duplicate keys. It helps ensure that JSON data structures do not contain duplicate keys, which can lead to unexpected behavior in applications.

What are json-dup-key-validator's main functionalities?

Validate JSON String

This feature allows you to validate a JSON string to check for duplicate keys. The `validate` function returns an object indicating whether the JSON is valid and lists any duplicate keys found.

const { validate } = require('json-dup-key-validator');

const jsonString = '{ "key1": "value1", "key1": "value2" }';
const result = validate(jsonString);
console.log(result); // Output: { valid: false, duplicateKeys: ['key1'] }

Validate JSON Object

This feature allows you to validate a JSON object directly to check for duplicate keys. The `validateObject` function returns an object indicating whether the JSON object is valid and lists any duplicate keys found.

const { validateObject } = require('json-dup-key-validator');

const jsonObject = { "key1": "value1", "key1": "value2" };
const result = validateObject(jsonObject);
console.log(result); // Output: { valid: false, duplicateKeys: ['key1'] }

Other packages similar to json-dup-key-validator

Keywords

FAQs

Package last updated on 06 Feb 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc