wwader
Re:The Git Commands I Run Before Reading Any Code
on Friday April 10, 2026 @07:42AM (#47716625)
Assume input is an array you can do it several ways depending on what you want:
# output each value in the array separately
.[]
# output each value but transform it in some way
.[] | . * 2
# map each value into a new array
map(. * 2)
# same as above but manual iterate/collect
[.[] | . * 2]
Re:Ask HN: What trick of the trade took you too long to learn?
on Tuesday August 05, 2025 @05:29AM (#44795982)
Same! and jq's regexp functions are quite powerful for transforming text into something more structured:
$ echo -e "10:20: hello\n20:39: world" | jq -cR 'capture("^(?<timestamp>.*): (?<message>.*)$")'
{"timestamp":"10:20","message":"hello"}
{"timestamp":"20:39","message":"world"}
$ echo -e "10:20: hello\n20:39: world" | jq -Rn '[inputs | capture("(?<t>.*): (?<m>.*)$").m] | join(" ")'
"hello world"
Also using inputs/0 etc in combination with reduce and foreach it's possible to process streams of text that might not end.
Re:Ask HN: What Are You Working On? (June 2025)
on Monday June 30, 2025 @07:53AM (#44422157)
Very nice! thanks for building this
Re:Xee: A Modern XPath and XSLT Engine in Rust
on Saturday March 29, 2025 @05:46AM (#43514140)
The jaq author is working on a formal specification of jq https://github.com/01mf02/jq-lang-spec. I think it has also help that there are several implementations of jq now like, gojq, jaq and jqjq, that has helped finding edge cases and weird behaviours.
Re:SQLite Disk Page Explorer
on Friday February 07, 2025 @08:28AM (#42972278)
The sqlite source includes a CLI tool called showdb that is quite nice for poking around in database files
Re:Cyphernetes: A Query Language for Kubernetes
on Tuesday December 17, 2024 @05:19AM (#42440092)
Note on (b): As i understand it JSONPath by design is limited to only be able to select things from the input, so can't build a new object, array etc.
Re:Useful built-in macOS command-line utilities
on Wednesday November 06, 2024 @03:39AM (#42058131)
open -a is nice, i use it with alias, ex:
alias qt='open -a "quicktime player"'
alias vlc='open -a "vlc"'
Re:Command Line Tools I Like (2022)
on Friday October 11, 2024 @06:44PM (#41814599)
Yeap the syntax and semantics is quite different to other languages and it really took me a long time and deep understanding to really appreciate how expressive and damn well designed it is.
Re:Command Line Tools I Like (2022)
on Thursday October 10, 2024 @04:57AM (#41796963)
As a heavy jq user and now a days also maintainer i say welcome! happy to help if you run into some problem
Re:I have 2000 old VHS tapes in my garage and I don't know what to do ...
on Sunday September 29, 2024 @03:32PM (#41689751)
Yeap love things like that, ex https://www.imdb.com/title/tt1787791/ and the mystery show podcast. Let me know if you know any!
Re:I have 2000 old VHS tapes in my garage and I don't know what to do ...
on Friday September 27, 2024 @03:01AM (#41667182)
Reminds me of the documentary Kim's video https://www.imdb.com/title/tt24132144/ recommended!
Re:How Gzip Work
on Tuesday September 17, 2024 @08:00AM (#41566746)
I think the alpine package format do use this in combination with tar being similar https://wiki.alpinelinux.org/wiki/Apk_spec
Re:Binsider – A TUI for analyzing Linux binaries
on Thursday September 12, 2024 @04:40AM (#41518772)
Nice haven't seen. Shameless plug fq support elf https://github.com/wader/fq and will have a look if i could lend some ideas from llvm-readelf
Re:Why You Should Learn Linux (As a Developer)
on Sunday September 01, 2024 @02:41PM (#41419203)
I once dumped a cassandra cluster to json (10ish gb i if remember correctly) and used jq to do queries
Re:TomWright/dasel: Select, put and delete data from JSON, TOML, YAML,...
on Tuesday August 20, 2024 @10:25AM (#41300371)
Comparison of last example from https://axel.leroy.sh/quick-refs#dasel
desel: .data.all().filterOr(moreThan(.quantity,3),equal(.quantity,3)).mapOf(key,key,quantity,quantity)
yq: .data[] | select(.quantity >= 3) | {"key": .key, "quantity": .quantity}
jq: .data[] | select(.quantity >= 3) | {key, quantity}
Re:TomWright/dasel: Select, put and delete data from JSON, TOML, YAML,...
on Tuesday August 20, 2024 @10:15AM (#41300278)
Hey! thanks for the jqjq shoutout!
Re:Jqjq: Jq Implementation of Jq
on Sunday July 07, 2024 @01:12PM (#40898922)
> Oh oh, jq has bugs..., I hope you reported them. I wondered more than once whether I could trust the results of my jq invocations.
Yes report, and i'm one of the jq maintainers now a days :) and i think you can trust the result if your doing common things. The bugs i've encountered have usually been in exotic parts, ex https://github.com/jqlang/jq/issues/3128
Re:Jqjq: Jq Implementation of Jq
on Sunday July 07, 2024 @08:31AM (#40897169)
No sure what your talking about, i get happy every time i get to use jq! :)
Re:Jqjq: Jq Implementation of Jq
on Sunday July 07, 2024 @04:59AM (#40896185)
Yes it is! see the example in the readme how to run jqjq with jqjq. Sadly you will probably need a lot of memory, it used to work on my laptop but not anymore after some recent changes that seem to have increased memory use.
Re:Jqjq: Jq Implementation of Jq
on Sunday July 07, 2024 @04:57AM (#40896167)
"thanks" :)
Re:Jqjq: Jq Implementation of Jq
on Sunday July 07, 2024 @04:55AM (#40896160)
Hey! quite accurate, it was a mix of i just wanted to try to see how hard it would be and wanted to know more about jq. I guess it has limited practical use other than as a learning tool. But i've used it to prototype features for "original" jq like how eval could work, regex literals, some object literal syntax enhancements etc. Also i found a bunch of bugs and confusing behaviours in jq along the way :)
btw i didn't follow what you mean by "overlooked the 2 characters"?
Re:Jqjq: Jq Implementation of Jq
on Saturday July 06, 2024 @06:11PM (#40893735)
Hey! jqjq author here. Some time :) but surpassingly not that much, after getting over some major hurdles like how to mix recursive decent parsing and infix operators (precedence climbing is nice) and how to eval jq's call semantic that uses thunk/lambdas args it was mostly to grind through the rest. Actually string interpolation was quite tricky also. Also helped that i've worked on various jq other implementations and also written quite a lot of jq in general :)
Re:Show HN: Jb / json.bash – Command-line tool (and bash library) that...
on Thursday July 04, 2024 @04:56AM (#40873430)
jq has quite a few more ways to input things more than from stdin and files. Some examples:
$ abc=123 jq -cn '$ENV | {abc, othername: .abc}'
{"abc":"123","othername":"123"}
$ jq -cn --arg abc 123 '{$abc, othername: $abc}'
{"abc":"123","othername":"123"}
$ jq -cn --argjson abc 123 '{$abc, othername: $abc}'
{"abc":123,"othername":123}
Re:Show HN: Qq: like jq, but can transcode between many formats
on Monday July 01, 2024 @07:43AM (#40844811)
It do involve some quite complicated plumbing :) i hope i've made at least some more ppl interested in jq as a langauge and related tools with fq, jqjq, jq-lsp and by helping maintain the original jq project
Re:Show HN: Qq: like jq, but can transcode between many formats
on Friday June 28, 2024 @06:17AM (#40819225)
Thanks for the kind words! I have to pass along most of the credit to the designers of jq and jq CLI interface. Lots of care and thought have gone into those, also gojq was big enabler. I feel more like plumber that half accidentally connected a bitstream decoder with a hacked up version of jq :D
Re:Show HN: Qq: like jq, but can transcode between many formats
on Thursday June 27, 2024 @04:43AM (#40808569)
Hey! fq author here, just want to say that i've looked at rq also :) nice to see ppl explore developing tools like this
Re:Show HN: Qq: like jq, but can transcode between many formats
on Thursday June 27, 2024 @04:38AM (#40808548)
Note that gojq also fixes and improves on some things compared to jq, like arbitrary-precision arithmetic (jq only preserves), some semantic and parsing improvement and fixes that will likely happen in jq at some point also, time zone/formatting/parsing fixes, etc
Re:The simdjson library
on Tuesday June 11, 2024 @07:04AM (#40644812)
Hey, it was discussed a bit some years ago https://github.com/jqlang/jq/issues/1892
Re:Parsing JSON Is a Minefield (2018)
on Monday June 03, 2024 @04:18PM (#40567055)
jq tries to preserve number precision if you don't do operation with them, but as you noted this is within some sanity. If you do operations the involved numbers will first be converted to binary64 (aka double), same as node and most other languages. This is what is recommended by RFC 7159 for interoperability.