yq
yq copied to clipboard
Cannot combine `-j` and `--unwrapScalar`
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 ...
Yeah that was done on purpose (via other users requests) so that with '-j' you always get JSON that you can pipe into jq.
https://github.com/mikefarah/yq/issues/392 for reference
I was hoping to reduce some of my dependencies on jq, but I guess not for now
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
Fixed (finally) in 4.30.1