Change json array to dictionary#2530
Change json array to dictionary#2530Freed-Wu wants to merge 1 commit intolervag:masterfrom Freed-Wu:re
Conversation
jq can only sort json dictionary. It is because json array is ordered which should not be sorted. I add a zero-width match to fix bug of `\faFile*`
|
Well, we don't need Further, it seems we spend a lot of effort in adding this check for something that will 1) rarely be changed, and 2) if it changes, I will still be aware it should be sorted and will take care to ensure it stays sorted. So, perhaps an alternative here is to just remove the workflow? |
sort cannot sort json dictionary. ❯ echo '{"b": 1,"a": 1}'|jq -S .
{
"a": 1,
"b": 1
}
❯ echo '{"b": 1,"a": 1}'|sort
{"b": 1,"a": 1}
This PR is only related to a regular expr. The PR about workflow is #2531. |
No, but
Yes. I'll think some more about this later today. I'm still skeptical of changing this back to a dictionary. The regex becomes harder to read and more complicated, and there really seems to be no real benefit in my opinion. That is, the only benefit is to allow the workflow to check that the json file is sorted. But the reason to check that it is sorted is precisely what you fix with the more complicated regex here. Still, perhaps having it as a dictionary makes sense in other ways, so I'll reconsider later today. |
|
Ok, I've merged this while making a few minor changes:
|
jq can only sort json dictionary. It is because json array is ordered which should not be sorted. I add a zero-width match to fix bug of
\faFile*