yq icon indicating copy to clipboard operation
yq copied to clipboard

Cannot combine `-j` and `--unwrapScalar`

Open ghostsquad opened this issue 5 years ago • 4 comments
trafficstars

Describe the feature jq has a "raw" mode. Basically if it's a scalar value, it outputs the raw value unquoted. Otherwise returns the json representation (for arrays, objects).

It's useful to combine these 2 flags so that I can write a function that "does the right thing", and let the caller decide what to do next (based on it's expectations that the result will be scalar or not)

Command The command you ran:

yq r -j --unwrapScalar ...

ghostsquad avatar May 12 '20 17:05 ghostsquad

Yeah that was done on purpose (via other users requests) so that with '-j' you always get JSON that you can pipe into jq.

mikefarah avatar May 12 '20 23:05 mikefarah

https://github.com/mikefarah/yq/issues/392 for reference

mikefarah avatar May 13 '20 00:05 mikefarah

I was hoping to reduce some of my dependencies on jq, but I guess not for now

ghostsquad avatar May 13 '20 00:05 ghostsquad

Though the issue you linked to, doesn't discuss what to do when --unwrapScalars is explicitly set

It would be nice if, when these 2 flags are explicitly set, it acts like raw mode in jq

ghostsquad avatar May 13 '20 00:05 ghostsquad

Fixed (finally) in 4.30.1

mikefarah avatar Nov 11 '22 04:11 mikefarah