Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Json5 features #1152

Open
simonrouse9461 opened this issue Apr 15, 2024 · 0 comments
Open

Support Json5 features #1152

simonrouse9461 opened this issue Apr 15, 2024 · 0 comments

Comments

@simonrouse9461
Copy link

simonrouse9461 commented Apr 15, 2024

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

  • Strings may span multiple lines by escaping new line characters.
  • Numbers may be hexadecimal.
  • Numbers may have a leading or trailing decimal point.
  • Numbers may be IEEE 754 positive infinity, negative infinity, and NaN.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant