358 karma · joined May 7, 2020
@canardivore on twitter
This is a timeless post. We'll see it today. We'll see it in five years. We'll see it in 10 years.
https://xkcd.com/927/ applies
1 - Giving away info without consent
2 - The crime of abusing police resources.
You can also generalize it without learning a new minilanguage by using https://github.com/tyleradams/json-toolkit which converts csv/binary/whatever to/from json
Convert json <-> xml, csv, yaml, logfmt
So to support all formats, you write a binary <-> json converter.
What can angle grinder do better than jq?
Obviously thats a different league, but I bet the temptation to get a "high score" feels the same. This post is a good reminder not to worry so much about the score, so thanks again
Harder: People
Impossibly hard: Help people get faster at building tech
And yet it's all I want to do.
In a future post, I'll cover how to use jq not just for json and xml but any data format.
In python, you can have a jq like experience with
def f(data):
# put code here
data = json.load(sys.stdin)
output = f(data)
print(json.dumps(output))When teaching though, I'd rather make the it more visually explicit that jq commands are a sequence of filters. With the former notation, a | explicitly tells the reader that it's the end of one filter and the start of a new one, the latter is more implicit.
There's tools for converting between json and other data formats like xml as well as misc tools like json-diff which diffs json files and formats the output as json.
In my limited experience I haven't seen people use the <array> container and the xml parser still works, although it is a good idea.