GithubHelp home page GithubHelp logo

better-json's Introduction

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}

better-json's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.