Skip to content
Removes whitespace and JavaScript-style comments from a JSON string.
JavaScript
Failed to load latest commit information.
example Initial commit. Jun 4, 2012
test Add Tap unit tests. Jun 4, 2012
.travis.yml Add Travis support. Jun 4, 2012
README.md Add Travis build status badge. Jun 4, 2012
index.js Initial commit. Jun 4, 2012
package.json `json-compressor` v0.0.2. Jun 4, 2012

README.md

json-compressor

Travis Build Status

json-compressor is a simple Node module that removes whitespace and JavaScript-style comments from a JSON string.

$ npm install json-compressor

Example

var fs = require("fs"), compress = require("../"), source = fs.readFileSync("example.json", "utf8");
console.log(JSON.parse(compress(source)));
=> { "name": "Kit", "age": 19, "hobbies": ["programming", "running"], "source": "123\\n// Line comment.\\n/* Block comment. */\\n456" }

License

Public domain.

Something went wrong with that request. Please try again.