pkoppstein

Results 169 comments of pkoppstein

@itchyny wrote: > Maybe haspath($p) does not need to list all the paths. It doesn't. That's what `first/1` is for.

@itchyny - Your `haspath` uses a form of recursion which jq does not support efficiently. Here's an efficient implementation that uses the same insight: ``` def haspath($path): def h: ....

@itchyny - Please read up on TCO on the jq wiki. You could start at https://github.com/stedolan/jq/wiki/Advanced-Topics#tail-call-optimization

@pasamio wrote: > I'd like to use a single match on them by being able to use the same case. If you have access to a recent (github) version of...

@nikolay - ascii_upcase and ascii_downcase have been in "master" on github since Dec 27. Their definitions can also be used in jq 1.4, as explained in the [FAQ](/stedolan/jq/wiki/FAQ).

Some of the proposed solutions in this thread are unnecessarily and even grossly inefficient, but the topic of iterations as it relates to jq and various shells is too large...

@arielelkin - Regarding your comment about `--nul-output`: (1) This is a documented feature of the "development" version of jq (https://stedolan.github.io/jq/manual/) (2) There are several versions of jq, and each online...

This response to the original question focuses on: 1) a jq-only solution 2) a jq+bash solution 1. jq-only ``` jq -cr '.users[] | "\(.description) is \(.height)"' sample.json ``` Here, the...

https://github.com/kislyuk/yq has been added to the answer regarding YAML on the jq FAQ.

For the record, `strflocaltime` behaves properly on a Mac, whether using jq 1.5 or 1.6: ``` TZ=Asia/Tokyo jq-1.6 -rn 'now | strflocaltime("%Y-%m-%dT%H:%M:%S%z")' 2022-05-09T04:30:43+0900 TZ=Asia/Tokyojq-1.5 -rn 'now | strflocaltime("%Y-%m-%dT%H:%M:%S%z")' 2022-05-09T04:32:25+0900 ```