https://github.com/angeal185/json-min-max
json minify and beautify for nodejs or browser
https://github.com/angeal185/json-min-max
beautify json minification minify pretty-print
Last synced: about 1 month ago
JSON representation
json minify and beautify for nodejs or browser
- Host: GitHub
- URL: https://github.com/angeal185/json-min-max
- Owner: angeal185
- License: mit
- Created: 2019-01-04T01:10:29.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-04T06:18:37.000Z (over 7 years ago)
- Last Synced: 2025-09-21T04:42:15.187Z (10 months ago)
- Topics: beautify, json, minification, minify, pretty-print
- Language: JavaScript
- Homepage:
- Size: 4.88 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# json-min-max
##### json minify and beautify for nodejs or browser
### Installation
npm:
```sh
$ npm install json-min-max --save
```
#### server-side example
```js
const JMM = require('json-min-max');
// minify
fs.readFile('./unminified.json', 'utf8', (err, data) => {
if (err) throw err;
console.log(JMM.minify(data));
});
// beautify
fs.readFile('./minified.json', 'utf8', (err, data) => {
if (err) throw err;
// default indentation is 2
console.log(JMM.beautify(data,4));
});
```
#### browser example
```html
<script>
// minify
let x = document.getElementById('unminifiedData').value;
console.log(JMM.minify(x));
// beautify
let y = document.getElementById('minifiedData').value
console.log(JMM.beautify(y,2));
```