json5mod

JSON5 (mod) parse/stringify.


Keywords
cross, hjson, json, json5, parser
License
MIT
Install
haxelib install json5mod 0.0.1

Documentation

MIT License

json5mod

JSON5 parser and encoder for Haxe.

This library uses some ideas from https://github.com/nadako/hxjsonast/. It implements the JSON5 parser with some extensions from HJSON:

  • Identifiers not wrapped in quotes.
  • Single-quotes for strings.
  • HJSON style comments.
  • HJSON style multi-line strings.
  • Dangling commas (commas are even optional).
  • Numbers may be hexadecimal.
  • Numbers may have a leading or trailing decimal point.
  • The parser returns a typed object (which can be converted to Any)

Usage

import gs.json5mod.Json5;
var y = Json5.parse("{}");

The demo folder contains an example for openfl with simple live reload support. demo

Links:

https://json5.org/

https://github.com/json5/json5

http://hjson.org/

https://github.com/hjson/

https://github.com/nadako/hxjsonast