ceson

Yet another JSON derivative, aimed to be easy to use for humans as well as for low-level tools.

Usage no npm install needed!

<script type="module">
  import ceson from 'https://cdn.skypack.dev/ceson';
</script>

README

 CESON: Commented ECMAScript Object Notation

Yet another JSON derivative, aimed to be easy to use for humans as well as for low-level tools.

✨ 📖 ✨ spec ✨ 📖 ✨ example ✨ 📖 ✨

Main features:

  • True subset of ECMAScript.
  • Parser-friendly (block and line) comments.
  • Comma after last value in data containers. (optional)
  • Guaranteed support for UTF-8 BOM.

Related projects:

API

For examples, see test/felidae.js.

.stringify(data)

Return a CESON representation of data as a string.

.parse(ceson[, opts])

Return the data represented by the string ceson if it can be parsed, or undefined in case of a SyntaxError. Other errors are re-thrown.

You can modify the behavior by providing a config object opts. The supported keys are:

  • synErr, othErr: Modify error handling. Documented at module json-parse-pmb since that's used under the hood.

.parseFile(filename, callback)

Try to parse CESON text file filename, then report to callback.

.parseFile(fileOpts, callback)

(no description yet)

.parseCallbackData(readErr, data, callback)

(no description yet)

License

ISC