If you've ever piped a dev server's output into jq to make the JSON logs
readable, you know this dance:
npm run dev | jq
Enter fullscreen mode
Exit fullscreen mode
{ "level" : 30 , "msg" : "server started" , ... } jq: error (at <stdin>: 0 ): Cannot index string with "level"
Enter fullscreen mode
Exit fullscreen mode
It worked for exactly three lines — until your app printed a startup banner, or a
plain console.log , or a stack trace. jq hit one line that wasn't valid JSON
and aborted the entire stream . Now you're back to reading raw JSON with your
eyeballs.
The thing is, real log output is never pure JSON. It's a mix: structured lines
from your logger (pino, winston, structlog, zap…), plus framework noise, plus
whatever you print() -debugged at 2am.…