google / jsonnet

Jsonnet - The data templating language
http://jsonnet.org
Apache License 2.0
6.87k stars 436 forks source link

Support Json5 features #1152

Open simonrouse9461 opened 3 months ago

simonrouse9461 commented 3 months ago

JSON5 brings ECMAScript 5.1 features to JSON. Jsonnet supports most of the JSON5 features with a few exceptions:

This means that the following JSON5 file cannot be properly loaded as valid Jsonnet:

{
  lineBreaks: "Look, Mom! \
No \\n's!",
  hexadecimal: 0xdecaf,
  leadingDecimalPoint: .8675309, andTrailing: 8675309.,
  nan: NaN, infinity: Infinity,
}

These features would be great additions to Jsonnet. Supporting them will make Jsonnet a superset of JSON5 and thus make the migraion from JSON5 to Jsonnet much easier. Additionally, these features are mostly backward-compatible with existing Jsonnet syntax (except NaN and Infinity). Please consider supporting them.