0

Trying to use jq to beautify output in terminal in real-time using telnet

I downloaded and installed jq on my mac and I executed a telnet code in the terminal to try and make the output readable

telnet 192.168.31.2 8085 | grep -A 1 -e 'LOG DEBUG : sending a POST request to https://analytics-ingestion.staging-public.tubi.io/analytics-ingestion/v2/single-event' -e 'received' | jq '.'

I basically see a line by line outline of the output:

"event":{"page_load":{"category_list_page":{},"load_time":257,"status":"SUCCESS"}}

I was expecting the format to be in nice json format - I looked everywhere but I can't seem to find how to append jq on telnet

bfontaine
  • 18,169
  • 13
  • 73
  • 107
  • 1
    Could you post the output you’re seeing vs. the one you would want to see? Some example data would be helpful to understand your issue. – bfontaine Jul 02 '19 at 16:03
  • This is what I an seeing @bfontaine "event":{"page_load":{"category_list_page":{},"load_time":257,"status":"SUCCESS"}}, – Gerry Paneda Jul 03 '19 at 14:08
  • @bfontaine sorry I don't know how to post json format but basically a line by line outline of the output – Gerry Paneda Jul 03 '19 at 14:16
  • Thanks, I edited your question to add these details in it. I don’t get why it doesn’t work, I literally pipe multiline JSON in `jq` every day and it does pretty-print it. There’s no option to force the pretty-printing because it’s the default. Does a simple `echo '{"a": 1}' | jq .` shows pretty-printed JSON? – bfontaine Jul 03 '19 at 15:46
  • how does the output look like if you don't pipe the `jq` command? – Yaron Schwimmer Dec 10 '19 at 09:31

0 Answers0