2

I'm hitting an endpoint for status info which returns JSON

watch 'curl localhost:8000/something | jq' 

which just returns "(23) Failed writing body" which is from jq. What does jq want here?

Note this works without the watch part?

CpILL
  • 6,169
  • 5
  • 38
  • 37
  • Does this answer your question? [Why does cURL return error "(23) Failed writing body"?](https://stackoverflow.com/questions/16703647/why-does-curl-return-error-23-failed-writing-body) – Ken Y-N Oct 28 '20 at 01:21
  • no, none of them worked for me. As i stated it seems to work without `watch` but not with it? all of those questions are about piping curl into jq which works fine for me until i use watch – CpILL Oct 28 '20 at 01:53
  • 1
    What makes you say the error message "is from jq"? It's a well-known `curl` message ... – peak Oct 28 '20 at 02:09
  • 1
    Try using `jq .` instead of just `jq`. Have you tried using `curl -N` to disable curl buffering? You might also like to try increasing the `watch` time interval. – peak Oct 28 '20 at 02:24
  • `jq .` did it! Thank you! – CpILL Oct 28 '20 at 02:42
  • Works for me out of the box. – Benjamin W. Oct 28 '20 at 02:44

1 Answers1

4

This did it:

watch 'curl localhost:8000/something | jq .' 
CpILL
  • 6,169
  • 5
  • 38
  • 37