Need private packages and team management tools?Check out npm Teams »

json-min-max

1.0.0 • Public • Published

json-min-max

json minify and beautify for nodejs or browser

Installation

npm:

$ npm install json-min-max --save

server-side example

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

<script src="./dist/jsonMinMax.min.js">
<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));
</script> 

Install

npm i json-min-max

DownloadsWeekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

3.4 kB

Total Files

7

Last publish

Collaborators

  • avatar