mirror of
https://github.com/dehydrated-io/dehydrated.git
synced 2026-01-11 22:30:44 +01:00
Better JSON parsing #311
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @lukas2511 on GitHub (Mar 18, 2018).
Originally assigned to: @lukas2511 on GitHub.
Currently dehydrated has very rudimentary JSON parsing which often results in issues with similarly-named values (like the recent #515 where dehydrated used the
urlstring from a sub-dictionary instead of the root).All JSON parsing should be replaced by something that actually "understands" the JSON structure instead of greping for values inside of it.
I had a look at JSON.sh which looks promising and I actually started stripping it down to only the required functionality and making it compatible with all the bash/zsh options set in dehydrated.
I also looked at some other "libraries" which used awk or sed for the parsing, but those seemed to be problematic on BSD and older GNU/Lunix systems.
So for now I'm planning on integrating JSON.sh, but if anybody knows about similar projects feel free to comment.
@bzed commented on GitHub (Apr 24, 2018):
https://github.com/stedolan/jq is available in most distributions these days. Not on older systems, though.
@vidensky commented on GitHub (Feb 5, 2020):
Step-ca authority does not work due to bad parsing of JSON.
see # 689
@lukas2511 commented on GitHub (Feb 6, 2020):
I'm going to prioritize work on this. Will be the next thing after getting the code-testing system running (which for me is a hard requirement before I'm going to change anything around JSON parsing).
@vidensky commented on GitHub (Feb 6, 2020):
This is good news.
Yesterday we looked at JSON.sh, https://github.com/step-/JSON.awk and https://github.com/stedolan/jq.
JQ is in my opinion the best choice. Even at the cost of dependence on another utility. JQ has been in the Debian repository since version 8. So 5 years ago. on other OS versions, we didn't look.
@lukas2511 commented on GitHub (Feb 6, 2020):
@vidensky Yea, i'd really like to simply use jq, but since dehydrated is running on a lot of older systems where jq is not available that would be not-so-great for a big part of the userbase. I have a prototype of a JSON.sh integration... somewhere... (it's been a while ago...), I think that would be the best route to take.
@lukas2511 commented on GitHub (Jul 5, 2020):
There now is an experimental branch https://github.com/dehydrated-io/dehydrated/tree/jsonsh including JSON.sh as JSON parser.
@lukas2511 commented on GitHub (Sep 30, 2020):
Closing this issue as JSON.sh is now integrated into the main branch. Please open separate issues if you want to report a related problem.