-
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
Readable compact format #26
Comments
You are talking about
That would only work for Hjson if none of the elements inside are quoteless strings (they require a new line each). If it was only allowed in combination with the "quote all strings" option it would probably be easy to implement here, otherwise no. |
@laktak would it make sense to have a "mixed" approach - if multiple values can fit on the same line, encode them as regular JSON (just like compact json formatter does). Otherwise, follow HJSON rules |
Like I said, that won't be easy to do. What is your use case? How would you define "fit on the same line"? |
@laktak I was hoping to adapt HJSON to Vega (JSON) editing -- HJSON should make this code much more readable (BTW, is there a HJSON support for Monaco text editor?). A small set of values in a list should be on the same line -- e.g. |
After thinking about why this can't work I experimented a bit and found it to be working quite well :) Thanks for the idea! You need to call
Let me know if this works for you. |
@laktak this is an awesome start! Here is an example of a compact( len=65 ) json and hjson representation of a Vega diagram with your new changes. The compact JSON is still more compact and readable, because the eyes do not stumble on each "{" and "[" that occupies a separate line: https://gist.github.com/nyurik/96ab0d0d19d4c3aee83b0250fbb9335c/revisions Do you think the initial (not trailing) Thanks for your hard work!!! |
Happy to help with your project. Looks very cool btw! There's actually a switch for controlling the braces:
|
This is awesome, thanks!!! |
Is there a "compact but readable" format for HJSON? Something like https://github.com/lydell/json-stringify-pretty-compact for JSON?
Thanks!
The text was updated successfully, but these errors were encountered: