Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot combine -j and --unwrapScalar #437

Closed
ghostsquad opened this issue May 12, 2020 · 5 comments
Closed

Cannot combine -j and --unwrapScalar #437

ghostsquad opened this issue May 12, 2020 · 5 comments

Comments

@ghostsquad
Copy link

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 ...
@mikefarah
Copy link
Owner

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
Copy link
Owner

#392 for reference

@ghostsquad
Copy link
Author

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

@ghostsquad
Copy link
Author

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

@mikefarah
Copy link
Owner

Fixed (finally) in 4.30.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants