-
Notifications
You must be signed in to change notification settings - Fork 49
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
How does this compare to json5? #48
Comments
The things that I can see that are most obvious is that json5 requires comma delimiting (though trailing commas are OK) and quoting of strings as a value (keys do not need quoted), but json5 also supports in-line comments. |
I've been researching config formats lately, and so far hjson is the front-runner for supporting comment-preserving edits in its node implementation. Haven't found anything else yet that satisfies this requirement in a node implementation. Kudos to the hjson team for prioritizing this awesome feature! |
JSON5 is a project to use ES5-like syntax for config files, and it's mainly tailored to a JavaScript implementation last I checked. Hjson is a similar format designed to be more a more human-friendly version of JSON, and has libraries across many different languages. They are indeed very similar - they are both supersets of JSON that try to improve the UX, but take slightly different and incompatible approaches. Compared to JSON5, in Hjson commas are optional at the ends of lines, quoteless object keys are more flexible, and quoteless string values are a thing (although they are slightly different than YAML's quoteless strings). However, Hjson does not natively support hex, octal, or binary numbers, NaNs, infinities, or leading plusses like JSON5 does. The JavaScript implementation of Hjson is the main one, and it supports node-based comment editing like @lewisl9029 mentioned in trying to satisfy the concept of a config file as human-machine interface. |
How does this compare to json5? Would be nice if the readme at least mentioned whats different between the two.
The text was updated successfully, but these errors were encountered: