Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/inadarei/cleanjson
cleanjson - npm package to format "dirty" JSON and put commas in front - where they belong :)
https://github.com/inadarei/cleanjson
Last synced: 23 days ago
JSON representation
cleanjson - npm package to format "dirty" JSON and put commas in front - where they belong :)
- Host: GitHub
- URL: https://github.com/inadarei/cleanjson
- Owner: inadarei
- License: mit
- Created: 2013-05-31T01:26:47.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-12-01T06:14:12.000Z (almost 10 years ago)
- Last Synced: 2024-10-13T11:15:39.063Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 123 KB
- Stars: 8
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
## Installation
```
$ npm install -g cleanjson
```## CLI Usage
1. Publish your "dirty" JSON at some URL using services such as http://hastebin.com, http://gist.github.com or http://cl.ly
1. Acquire a URL that points to "raw" JSON, such as: http://goo.gl/7IiVZ
1. Run a command such as:
```
$ curl -Ls http://goo.gl/7IiVZ | cleanjson
```
1. Enjoy### Using as a Module
```javascript
var cj = require('cleanjson');var input = '{"a": 13123, "b": "13123", "ccc": 112}';
cj.clean(input, function(err, cleanJSON) {
console.log(cleanJSON);
process.exit(0);
});
```will produce following output:
```javascript
{
"a": 13123
, "b": "13123"
, "ccc": 112
}
```