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

Compact binary data option #186

Closed
DonaldTsang opened this issue Sep 18, 2018 · 5 comments
Closed

Compact binary data option #186

DonaldTsang opened this issue Sep 18, 2018 · 5 comments
Assignees

Comments

@DonaldTsang
Copy link

DonaldTsang commented Sep 18, 2018

Having a binary data representation of JSON5, since others have a better way of making things compact.

@jordanbtucker
Copy link
Member

Most JSON5 documents can just be converted to JSON before being converted to a binary format. The only exceptions are documents that include NaN or Infinity. (This is the main reason I wrote json5/json5-spec#2.)

JSON5 isn't really meant to be a machine-to-machine language like how JSON is often used. At its heart, JSON5 is JSON for Humans. That's why configuration files make the best candidates for JSON5 documents.

If you convert JSON5 to any other representation—whether it's JSON, a binary format, a native data structure in C++, etc—you usually lose the features that make JSON5 what it is (i.e. comments are stripped, hex numbers are converted to floating points, strings are normalized, etc.).

So, supporting a binary version of JSON5 doesn't seem to provide any more benefit than just converting JSON5 to JSON and then converting that to BSON or MsgPack.

@DonaldTsang
Copy link
Author

I was expecting a binary format specification of JSON5 to not have "lost features" as there are always ways of linting that allow JSON5 to save space.

@jordanbtucker
Copy link
Member

@DonaldTsang I understand what you're proposing, however I'm still not convinced in the usefulness of the feature. What would you gain by having yet another binary data format?

@DonaldTsang
Copy link
Author

I would admit that it is not entirely useful to have a binary-JSON5, from what I observe there are not many people forking JSON5 and having pull request, and that could be the reason why it hasn't really taken off yet as a ubiquitous standard.

@jordanbtucker
Copy link
Member

I'm not sure what the ubiquity of JSON5 has to do with the need for a binary representation of JSON5, but I'm closing this for now. Thanks for the suggestion.

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

No branches or pull requests

2 participants