UrlChecker
UrlChecker copied to clipboard
Use a YAML editor rather than JSON for definitions
Describe a related problem (optional)
Currently editing massive JSON content isn't the most user-friendly experience, especially for regexes and stuff since it forces you to have extra characters to escape certain things.
Describe your suggested feature
A YAML library such as SnakeYaml could be used to handle the serialization/formatting of data.
And given that YAML is a superset of JSON, but marginally more user human-friendly, backwards compatibility should be very easy to maintain.
The introduction of the YAML editor will likely require the usage of a code editor like sora-editor or Squircle-CE in order to make indentation and syntax-highlighting a bit easier.
Describe alternatives you've considered for your suggested feature
No response
Other details
No response
Acknowledgements
- [x] I have searched the existing issues and this is a new ticket, NOT a duplicate or related to another open issue.
- [x] I have written a short but informative title.
- [x] I will fill out all of the requested information in this form.
I tried to do some rewrites on the way we store the data on #397 , but I will need to do it again as I found some conceptual mistakes. When I did those I tried to keep in mind other possible formats, like yaml, maybe after I finish it the conversion could be easy. Although, I won't promise anything, as I can't make those decisions.
Also, Triangulo wanted to do a new json editor, I think there is some code for that already in the app.
I've always wanted to write small-size apps, and this usually (not always) require minimal code and no dependencies. The decision to use JSON was because it is native on Android, you don't need anything to use it, it's already there. I'm not oppose to switching to yaml, although in this case I would prefer to maintain both (maybe a solution would be to allow editing the json as yaml, if that's even possible).
As for editors, the 'new json editor' is already done, which from a user perspective was basically changing from a small popup to a full activity (internally there were some more changes). Again, I don't reject using a library to include an advance editor with syntax highlighting or auto-completion, but I would like to keep the increased app size limited.
In both cases adding such a change would be a big change, and knowing myself I'm not sure if I would have even more time to review that :( but if you any of you know of a small improvement in this regard (maybe as I said adding a basic yaml editor to edit the json, assuming it requires a couple classes at most) I'm open to discussing it.
Btw: since the beginning I also wanted to add custom editors instead of just a textview with the plain json (think like a list with an add button, a textbox for each string, a checkbox for booleans, etc) and leave the json editor as an advanced raw editor (that's why it was originally called 'advanced editor' btw). However designing such UIs is complex and I'm horrible at that, and editing json is enough and powerful enough (perhaps too powerful) so I've prioritized other features...
Maybe adding a way to send the our files to other apps that can edit text files (also easily export/import so it can be edited on PC)? If there are apps to nicely edit json or yaml, then we wouldn't need a library for it. Only thing left would be the actual support for yaml files.
That's a good idea actually, the content is already stored on a file. Ideally there should be a way to 'export' the file to external apps so that they can edit it, if that's not possible maybe just copying it to the external storage or sending a string could be an alternative.
maybe a solution would be to allow editing the json as yaml, if that's even possible
I think that should be easily possible, given the data is already valid JSON Object, and YAML being a superset can read JSON just fine, I think it'd just be a matter of choosing whether it's rendered using the new YAML format (or rendered using the original native JSON one).
Supporting multiple syntaxes using either of the editors linked should be fairly easy, would just need to sandbox and review how much bigger the final APK is as a result of it