Datapacks use JSON for a lot of config. JSON is a good format, but it can be frustrating to use, and keep clean, at times.
JSON5 is a humanized version of JSON. It allows for comments, removes the need for quoting (some) keys, and has other quality of life improvements. Best of all, it is backwards compatible with JSON. Using a JSON5 parser would allow for these improvements, and would still read the JSON of older Datapacks.
Some nice JSON5 features:
- Keys do not need quotes if they stick to alphanumeric characters (JS Identifier Name).
- Strings can span multiple lines, if the line break is escaped.
- Strings can be single quoted.
- Comments (would greatly help communication in group development of Datapacks).
Full page about the spec: https://json5.org/
An open source Java implementation I found: https://github.com/marhali/json5-java
Please sign in to leave a comment.
0 Comments