8

I wanted to test a json file locally with command (in bash)curl "https://jsonplaceholder.typicode.com/users" | jq by following this tutorial video: https://www.youtube.com/watch?v=rrjIVepRqPI

I followed each step and added the executable file in the env variable path, but not working at all, I got result:

$ curl "https://jsonplaceholder.typicode.com/users" | jq
bash: jq: command not found

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  4670    0  4670    0     0   8584      0 --:--:-- --:--:-- --:--:--  8584
curl: (23) Failed writing body (795 != 1369)

Am I missing anything? Why I still got error bash: jq: command not found??

wawawa
  • 2,835
  • 6
  • 44
  • 105

1 Answers1

21

You can run a jq.exe from git bash.

You only need to install it in your git bash PATH:

curl -L -o /usr/bin/jq.exe https://github.com/stedolan/jq/releases/latest/download/jq-win64.exe

Then jq will work with your pipe command.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Hi two questions based on your answe: 1) how do I if I need to dowload win-32 or win-64? 2) how do I know which is my bash path? – wawawa Dec 09 '20 at 09:08
  • @Cecilia 1/ 64 bits. 2/ `echo $PATH` (but the command mentioned already put it in the `$PATH`, since `/usr/bin` is in the `PATH`). Do all that in a git bash session. – VonC Dec 09 '20 at 09:17
  • 2
    Hi I've just resolved this issue by using `choco install jq`, it works like a chearm, but thanks for your answer! – wawawa Dec 09 '20 at 09:18
  • @Cecilia No need for choco: simple curl and you are good to go. – VonC Dec 09 '20 at 09:19
  • 1
    @Cecilia thank you so much for your answer. I'd give the +1 to you: `choco install jq` works perfectly – Danilo Carrabino Feb 15 '21 at 08:44