-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
jq - windows examples #392
Comments
whatever i use i get: |
do you have a windows example which can take an object like it creates each value in a new row for me. Thanks |
It's all about the quoting:
.Unit" The cmd.exe shell is not like a Unix shell... |
I've updated the manual in master; I'll update the site later today. |
Can we have a simple and complete example to pretty print a json file on Windows? One really should not have to spend more than 5 minutes reading through the docs and trying to figure out how in the world to accomplish the simplest possible JSON task, pretty-printing a .json file, without getting
at every attempt.
|
yeah, for simple tasks like that it's easier to just use jsonlint (and grep) |
@dandv The problem is the shell, not jq. The problem here is that the shell doesn't handle single quotes like a Unix shell: it passes the single quotes to jq, and since single quotes are not a normal part of a jq program, you get an error. I think we could add some rules to the parser to produce an error message that might help the user understand. Anyways, |
There's now a Windows section in the FAQ. And there's a FAQ on this topic. |
It looks like even in powershell in windows you have to backslash the doublequotes...sometimes. Maybe powershell should be mentioned in the faq? echo '"Hello"' | jq '. + \" world\"'
"Hello world" Can't get this to work (it works for powershell in osx at least): jq -n '\"Hello world!\"'
jq: error: syntax error, unexpected $end, expecting QQSTRING_TEXT or QQSTRING_INTERP_START or QQSTRING_END (Windows cmd shell quoting issues?) at <top-level>, line 1:
"Hello
jq: 1 compile error |
@jszabo98 Windows doesn't use single quotes, and since you're escaping the double quotes, it's splitting on the space. Try |
Powershell uses both single quotes and double quotes. But somehow the double quotes sometimes get lost with external programs, even within single quotes. |
@jszabo98 oh, that's because on Windows there's no proper argument vector, and programs have to do their own command-line parsing. |
Sadly this doesn't work for me. Here is my code: @nicowilliams do you have any ideas? |
type file.json | jq A mi eso me sirvió Gracias |
Hi,
I am trying to run jq on an output from aws cli command but it does not work. i tried to run a simple example but it's not working as well. can you provide with some windows examples i can start play with?
Thanks
The text was updated successfully, but these errors were encountered: