Show HN: Catj – A new way to display JSON files
11–20 of 127 posts
Re: Show HN: Catj – A new way to display JSON files
#12Re: Show HN: Catj – A new way to display JSON files
#13Have you seen gron[0]? It's similar: flattens JSON documents to make them easily greppable. But it also can revert (ie, ungron) so you can pipe json to gron, grep -v to remove some data, then ungron to get it back to json. [0] https://github.com/tomnomnom/gron
Re: Show HN: Catj – A new way to display JSON files
#14And for purely aesthetic, nitpicky reasons I think the leading period in each line is redundant.
Re: Show HN: Catj – A new way to display JSON files
#15Have you seen gron[0]? It's similar: flattens JSON documents to make them easily greppable. But it also can revert (ie, ungron) so you can pipe json to gron, grep -v to remove some data, then ungron to get it back to json. [0] https://github.com/tomnomnom/gron
What does grep + gron give you over jq?
Re: Show HN: Catj – A new way to display JSON files
#16Earlier quoted context omitted.
What does grep + gron give you over jq?
as far as i can tell, jq doesn't do flattening .
Re: Show HN: Catj – A new way to display JSON files
#17The output format like a slightly better INI (in that it would support deeper hierarchies), although arrays would be a pain to write an index at a time like that. And for purely aesthetic, nitpicky reasons I think the leading period in each line is redundant.
Re: Show HN: Catj – A new way to display JSON files
#18Have you seen gron[0]? It's similar: flattens JSON documents to make them easily greppable. But it also can revert (ie, ungron) so you can pipe json to gron, grep -v to remove some data, then ungron to get it back to json. [0] https://github.com/tomnomnom/gron
What does grep + gron give you over jq?
The idea of flattening, grepping, then reverting sounds very appealing and sounds like a better fit for me.
Re: Show HN: Catj – A new way to display JSON files
#19this is not merely a display, it is really a sanitation of the brain-damaged json syntax.
Re: Show HN: Catj – A new way to display JSON files
#20 jq -j '
[
[
paths(scalars)
| map(
if type == "number"
then "[" + tostring + "]"
else "." + .
end
) | join("")
],
[
.. | select(scalars) | @json
]
]
| transpose
| map(join(" = ") + "\n")
| join("")
'
EDIT: Got the string quoting and escaping.EDIT 2: For those who want to save this script, you can put just the jq code in an executable file with the shebang:
#!/usr/bin/jq -jf