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

Add JSON5 support? #33

Open
GWRon opened this issue Oct 17, 2024 · 0 comments
Open

Add JSON5 support? #33

GWRon opened this issue Oct 17, 2024 · 0 comments

Comments

@GWRon
Copy link

GWRon commented Oct 17, 2024

For now we have Jansson.mod utilized for json.mod.

Would it make sense to also support json5? The main benefit (for me) of json5 is the comment support and the multiline strings. They increase "readability" a lot.

When just using it as "readable datastorage" then json will be enough but some advanced "config files" mit benefit from commands.
I guess vscode internally uses json5 too as the launch.json files there allow comments ... so maybe a good example of "how it can be good".

Json5:
https://json5.org

Sample json5 file:
https://github.com/chromium/chromium/blob/feb3c9f670515edf9a88f185301cbd7794ee3e52/third_party/blink/renderer/platform/runtime_enabled_features.json5

I am not aware of "the best c-library" for json5 (and the original implementation is TypeScript) so I just had a look what exists (amongst others):

https://github.com/detomon/json5

https://gist.github.com/inlife/b54a0d9228e428284e1d8eccbed97e35
-> but comments to that single-file-gist tell to use the newer one which can be extracted from the zpl-collection (which itself could have interesting things ...):
https://github.com/zpl-c/zpl/blob/master/code/source/parsers/json.c

Dunno if these implementations have issues with utf8 or so but they look rather "lightweight". Maybe UTF8-Handling can be done "afterwards" (similar to reading files with filestream.mod now).

Thoughts?

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