News for hackers. Stuff that matters.
Re: by rpigab on Wednesday June 07, 2023 @05:08AM (#36224576)
Sometimes, for extremely simple uses, when I don't want the hassle of selecting a Docker container that has jq, I'll just use a Python oneliner so I don't have to learn extra syntax, can use Python's list comprehensions, etc:

  <<< '{"a":"b", "c":"d"}' python3 -c 'import json,sys;print(json.loads(sys.stdin.read())["c"])'
This also works with a Python script with more lines if I need to add complexity or readability, or any feature, API calls, etc.
Re: by gigatexal on Friday June 09, 2023 @03:02PM (#36262479)
I’ve done this too. I almost went as far as creating my own version of fx with it but then decided like AWK if I wanted to do something really fancy I’d just write up a script or do that << EOF thing and do the code in line