LoginSignup
26
20

More than 5 years have passed since last update.

Macでjsonを見やすく整形する方法

Posted at

やりたいこと

$ cat some.json

{"searchengines":[{"title":"google","url":"http://google.co.jp"},{"title":"Yahoo!","url":"http://yahoo.co.jp"}]}
  • 要素が多くなってくると読みにくいので、整形して出力したい。

準備

jqインストール

$ brew install jq

使い方

$  cat some.json | jq

{
  "searchengines": [
    {
      "title": "google",
      "url": "http://google.co.jp"
    },
    {
      "title": "Yahoo!",
      "url": "http://yahoo.co.jp"
    }
  ]
}
  • 読みやすくなった。
  • highlightもしてくれた。
26
20
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
26
20