-
Notifications
You must be signed in to change notification settings - Fork 5
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
JSON #131
Comments
While I have not thought about json specifically, I did consider xml at one point. Json should be simpler than XML. One thing that would be needed would be a format-preserving Json parser and serialiser (e.g. not change newlines, indentation, no reformatting numbers, etc). For INI files I wrote my own code for this, but I'd rather not for Json as it is a more complex format. I also don't have a personal need for this, and this is a hobby project. So, contributions are welcome. If anyone is interested I'm willing to discuss the design (the first new format to support will be the hardest design-wise, as we need to make the code generic over the file format). |
So I had a think about what would be needed: JSON
Other formatsSide note about about XML (since I also considered this case): XML would be more complicated: you may not have unique keys, you can have text as siblings to nodes, you have attributes on nodes (not just contents) etc. Side note about toml: |
It looks like there's a SAX-style XML parser out there: https://docs.rs/xmlparser/latest/xmlparser/. It still sounds pretty awkward to support in some ways. Eg: let's say I want to support KXMLGUI files. The parts of KDE that write those files auto-prettify them, so it's possible that if a line gets too long, it reflows! How are we supposed to diff that? |
Xml would be even more complex than Json (see side note at the end of my comment above). I don't know how to handle it, nor do I currently have the energy to embark on a project like that. In fact, both json and xml support would have to be primarily done by someone other than me. |
Is your feature request related to a problem? Please describe.
Thank you for working on this useful project! I was wondering whether you'd consider adding support for JSON files?
Describe the solution you'd like
Initially it could be something basic, like just a list of paths to ignore.
Round-tripping JSON shouldn't be too difficult, and a lexer + parser that retains trivia should let you retain the same formatting on output.
Describe alternatives you've considered
N/A
Additional context
The text was updated successfully, but these errors were encountered: