Skip to content

cjdson/js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

js

NPM

cjdson is json with C style line and block comments

What does it look like?

{
  /*  JSON.parse won't be able to make sense of this
      but for extensive configs it's nice to have comments
      and lots of people use json for configs   */

  // everything else functions as you might expect
  "twentyThree":23 // numbers

  ,"aString":"pewpewpew" // strings
  ,"nesting":{ // it's basically just JSON
    "arrays":["pew","pew","pew"]
    ,"objects":{ // nothing really special
      "a":1
      ,"b":2
      ,"c":3
    }
  }
}

How do we use this library?

var CJDSON=require("./CJDSON.js");

var example=
  '{ \// lel\n'+
  '  "key":"val" // as per usual\n'+
  '  ,"pew":"pew" // throw in whatever valid JSON you want\n'+
  '  \/*  multiline comments!\n'+
  '      FTW   *\/\n'+
  '}';

var cjdson=new CJDSON(example);

console.log(cjdson.toString());
console.log(cjdson.parse());

new CJDSON('{"pew":"pew"\// comments...\n,"key":"val"\n}')
  .print();

About

cjdson is json with C style line and block comments

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published