Hacker News new | ask | show | jobs
by i0exception 3630 days ago
If you're familiar with vim, you can do this

  cat unformatted.json | python -mjson.tool | vim -
And then use vim's folding methods to navigate the file (http://vim.wikia.com/wiki/Folding)
2 comments

I use json.tool a lot too, but usually pipe it to `less`, using the paging and searching.
It's not nice to abuse innocent cats.

    python -mjson.tool < unformatted.json | vim -
If you're not using cat to concatenate things, the shell can probably handle the job.
People like cat because it allows notating the command closer to how they think. How can I pipe while putting the file first?
Well, just do it:

    < unformatted.json python -mjson.tool | vim -
What's the immediate advantage for me in using a less intuitive syntax? I understand cat is meant to concatenate files, so what?