Socket
Socket
Sign inDemoInstall

jsonc-parser

Package Overview
Dependencies
1
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jsonc-parser

Scanner and parser for JSON with comments.


Version published
Weekly downloads
17M
increased by0.12%
Maintainers
1
Install size
59.6 kB
Created
Weekly downloads
 

Package description

What is jsonc-parser?

The jsonc-parser npm package is used for parsing and manipulating JSONC (JSON with Comments) files. It provides functionality to parse JSONC content, extract errors, and visit nodes within the JSONC structure. It also allows for modifications and formatting of the JSONC content.

What are jsonc-parser's main functionalities?

Parsing JSONC

This feature allows you to parse JSONC content, which includes comments, without stripping them out. It can handle both single-line and multi-line comments.

{"text": "// This is a comment\n{\"key\": \"value\"}"}

Extracting Errors

jsonc-parser can extract errors from JSONC content, which is useful for validating and providing feedback on the correctness of the JSONC.

{"text": "{\"key\": \"value\", // invalid comment\n}"}

Visiting Nodes

This feature allows you to visit nodes within the JSONC structure and perform operations or analysis on them, such as logging property names.

{"text": "{\"key\": {\"nestedKey\": \"nestedValue\"}}", "visitor": {"onObjectProperty": (property, visitContext) => { console.log(property); }}}

Modifying JSONC

jsonc-parser provides functionality to modify the JSONC content by specifying the path to the node and the new value.

{"text": "{\"key\": \"value\"}", "modifications": [{"path": [\"key\"], "value": \"newValue\"}]}

Formatting JSONC

This feature allows you to format JSONC content according to specified formatting options, such as using spaces or tabs for indentation.

{"text": "{\"key\":\"value\"}", "options": {"insertSpaces": true, "tabSize": 2}}

Other packages similar to jsonc-parser

Readme

Source

node-request-light

A light weight nodejs request library with proxy support. Intended to be used by VSCode extensions

FAQs

Last updated on 18 Apr 2016

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