DEV Community

Yoriki Yamaguchi
Yoriki Yamaguchi

Posted on

Shell One-liner to view JSON got from any command on Chrome DevTools

$ any-command-that-outputs-json | node --inspect-brk --eval 'const chunks = []; process.stdin.resume().setEncoding("utf8").on("data", d => chunks.push(d)).on("end", () => {const result = JSON.parse(chunks.join("")); debugger;})'

Usage

  1. Execute the one-liner above.
  2. Open chrome://inspect and attach to the debugger by clicking the inspect link.
  3. On inspector, press F8 once to proceed a step.
  4. You'll get a variable named result that is a parsed object from the command.

See also

Top comments (0)