All Projects → sindresorhus → Strip Json Comments

sindresorhus / Strip Json Comments

Licence: mit
Strip comments from JSON. Lets you use comments in your JSON files!

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Strip Json Comments

Easy Mock Server
A mock server for json and mock template files
Stars: ✭ 22 (-95.53%)
Mutual labels:  json, npm-package
Ky
🌳 Tiny & elegant JavaScript HTTP client based on the browser Fetch API
Stars: ✭ 7,047 (+1332.32%)
Mutual labels:  json, npm-package
Conf
Simple config handling for your app or module
Stars: ✭ 707 (+43.7%)
Mutual labels:  json, npm-package
Jsonexport
{} → 📄 it's easy to convert JSON to CSV
Stars: ✭ 208 (-57.72%)
Mutual labels:  json, npm-package
Iguana
universal serialization engine
Stars: ✭ 481 (-2.24%)
Mutual labels:  json
Ignite Ui
Ignite UI by Infragistics
Stars: ✭ 468 (-4.88%)
Mutual labels:  npm-package
Jsonneverdie
Auto reflection tool from JSON to Model, user friendly JSON encoder / decoder, aims to never die
Stars: ✭ 466 (-5.28%)
Mutual labels:  json
Wiremock
A tool for mocking HTTP services
Stars: ✭ 4,790 (+873.58%)
Mutual labels:  json
Element Api
Create a JSON API/Feed for your elements in Craft.
Stars: ✭ 493 (+0.2%)
Mutual labels:  json
Zerolog
Zero Allocation JSON Logger
Stars: ✭ 5,642 (+1046.75%)
Mutual labels:  json
Folder Explorer
分析文件目录,统计数据并以树形结构和图表的形式展示结果,也可以导出多种格式留存
Stars: ✭ 479 (-2.64%)
Mutual labels:  json
Swiftai
SwiftAI, write Swift code smart. SwiftAI can generate Model class from JSON now. Codable and HandyJSON is supported. More features will be add.
Stars: ✭ 470 (-4.47%)
Mutual labels:  json
Zerocode
A community-developed, free, open source, microservices API automation and load testing framework built using JUnit core runners for Http REST, SOAP, Security, Database, Kafka and much more. Zerocode Open Source enables you to create, change, orchestrate and maintain your automated test cases declaratively with absolute ease.
Stars: ✭ 482 (-2.03%)
Mutual labels:  json
Vue Ls
💥 Vue plugin for work with local storage, session storage and memory storage from Vue context
Stars: ✭ 468 (-4.88%)
Mutual labels:  json
Canmatrix
Converting Can (Controller Area Network) Database Formats .arxml .dbc .dbf .kcd ...
Stars: ✭ 486 (-1.22%)
Mutual labels:  json
Tfjs Yolo Tiny
In-Browser Object Detection using Tiny YOLO on Tensorflow.js
Stars: ✭ 465 (-5.49%)
Mutual labels:  npm-package
Vue Json Pretty
A JSON tree view component that is easy to use and also supports data selection.
Stars: ✭ 477 (-3.05%)
Mutual labels:  json
Angular Translate
Translating your AngularJS 1.x apps
Stars: ✭ 4,414 (+797.15%)
Mutual labels:  npm-package
Vanilla Framework
From community websites to web applications, this CSS framework will help you achieve a consistent look and feel.
Stars: ✭ 476 (-3.25%)
Mutual labels:  npm-package
Json5
JSON5 — JSON for humans
Stars: ✭ 4,822 (+880.08%)
Mutual labels:  json

strip-json-comments

Strip comments from JSON. Lets you use comments in your JSON files!

This is now possible:

{
	// Rainbows
	"unicorn": /* ❤ */ "cake"
}

It will replace single-line comments // and multi-line comments /**/ with whitespace. This allows JSON error positions to remain as close as possible to the original source.

Also available as a Gulp/Grunt/Broccoli plugin.

Install

$ npm install strip-json-comments

Usage

const stripJsonComments = require('strip-json-comments');

const json = `{
	// Rainbows
	"unicorn": /* ❤ */ "cake"
}`;

JSON.parse(stripJsonComments(json));
//=> {unicorn: 'cake'}

API

stripJsonComments(jsonString, options?)

jsonString

Type: string

Accepts a string with JSON and returns a string without comments.

options

Type: object

whitespace

Type: boolean
Default: true

Replace comments with whitespace instead of stripping them entirely.

Benchmark

$ npm run bench

Related


Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].