0.3.8 • Published 7 months ago

better-json v0.3.8

Weekly downloads
3
License
MIT
Repository
github
Last release
7 months ago

Better JSON

npm GitHub top language NPM

npm npm

paypal

Simply better json with comments and auto normalization. You can either use it as a new object, or override the default JSON object.

  • comments are removed from strings
  • quotes are added where needed automatically
  • single quotes are corrected to double, when needed
  • types are auto corrected ('1' becomes 1)
  • trailing commas are removed
  • crash resistance (runs in a try catch block, and returns null on error)

Installation

npm install @aspiesoft/better-json

Setup

const json = require('@aspiesoft/better-json');

// or to override the JSON object
require('@aspiesoft/better-json')();

Usage

json.parse(`
{
    option1: string,
    //option2: true, /* commented out */
    option3: true,
}
`);
// expected output: {option1: 'string', option3: true}

json.stringify({test: 2, unwantedFunction: function(){}});
// expected output: {"test": 2}
0.3.8

7 months ago

0.3.7

2 years ago

0.3.6

4 years ago

0.3.5

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.3.4

4 years ago

0.3.3

4 years ago

0.2.0

4 years ago

0.1.10

4 years ago

0.1.8

4 years ago

0.1.9

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago