{"id":55,"date":"2018-07-05T03:45:09","date_gmt":"2018-07-05T03:45:09","guid":{"rendered":"https:\/\/www.rich-hsu.com\/blog\/?p=55"},"modified":"2018-07-05T03:46:22","modified_gmt":"2018-07-05T03:46:22","slug":"note-pretty-json-in-vim","status":"publish","type":"post","link":"https:\/\/www.rich-hsu.com\/blog\/note-pretty-json-in-vim\/","title":{"rendered":"[ Note ] Pretty JSON in VIM"},"content":{"rendered":"<p>As using VIM to review JSON data, the format and syntax might not be human readable.<\/p>\n<p>Using the following instruction in VIM to make the JSON data pretty!<\/p>\n<pre>:set syntax=json | %!python -m json.tool<\/pre>\n<p>And it works!<\/p>\n<p>Before:<\/p>\n<p><img data-attachment-id=\"58\" data-permalink=\"https:\/\/www.rich-hsu.com\/blog\/note-pretty-json-in-vim\/vim-json-format-before\/\" data-orig-file=\"https:\/\/i2.wp.com\/www.rich-hsu.com\/blog\/wp-content\/uploads\/2018\/07\/vim-json-format-before.png?fit=1708%2C410&amp;ssl=1\" data-orig-size=\"1708,410\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"vim-json-format-before\" data-image-description=\"\" data-medium-file=\"https:\/\/i2.wp.com\/www.rich-hsu.com\/blog\/wp-content\/uploads\/2018\/07\/vim-json-format-before.png?fit=300%2C72&amp;ssl=1\" data-large-file=\"https:\/\/i2.wp.com\/www.rich-hsu.com\/blog\/wp-content\/uploads\/2018\/07\/vim-json-format-before.png?fit=1024%2C246&amp;ssl=1\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58\" src=\"https:\/\/i2.wp.com\/www.rich-hsu.com\/blog\/wp-content\/uploads\/2018\/07\/vim-json-format-before.png?resize=300%2C72&#038;ssl=1\" alt=\"\" width=\"300\" height=\"72\" srcset=\"https:\/\/i2.wp.com\/www.rich-hsu.com\/blog\/wp-content\/uploads\/2018\/07\/vim-json-format-before.png?resize=300%2C72&amp;ssl=1 300w, https:\/\/i2.wp.com\/www.rich-hsu.com\/blog\/wp-content\/uploads\/2018\/07\/vim-json-format-before.png?resize=768%2C184&amp;ssl=1 768w, https:\/\/i2.wp.com\/www.rich-hsu.com\/blog\/wp-content\/uploads\/2018\/07\/vim-json-format-before.png?resize=1024%2C246&amp;ssl=1 1024w, https:\/\/i2.wp.com\/www.rich-hsu.com\/blog\/wp-content\/uploads\/2018\/07\/vim-json-format-before.png?resize=696%2C167&amp;ssl=1 696w, https:\/\/i2.wp.com\/www.rich-hsu.com\/blog\/wp-content\/uploads\/2018\/07\/vim-json-format-before.png?resize=1068%2C256&amp;ssl=1 1068w, https:\/\/i2.wp.com\/www.rich-hsu.com\/blog\/wp-content\/uploads\/2018\/07\/vim-json-format-before.png?w=1708&amp;ssl=1 1708w\" sizes=\"(max-width: 300px) 100vw, 300px\" data-recalc-dims=\"1\" \/><\/p>\n<p>After:<\/p>\n<p><img data-attachment-id=\"57\" data-permalink=\"https:\/\/www.rich-hsu.com\/blog\/note-pretty-json-in-vim\/vim-json-format-after\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.rich-hsu.com\/blog\/wp-content\/uploads\/2018\/07\/vim-json-format-after.png?fit=779%2C846&amp;ssl=1\" data-orig-size=\"779,846\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"vim-json-format-after\" data-image-description=\"\" data-medium-file=\"https:\/\/i0.wp.com\/www.rich-hsu.com\/blog\/wp-content\/uploads\/2018\/07\/vim-json-format-after.png?fit=276%2C300&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/www.rich-hsu.com\/blog\/wp-content\/uploads\/2018\/07\/vim-json-format-after.png?fit=779%2C846&amp;ssl=1\" loading=\"lazy\" class=\"alignnone size-medium wp-image-57\" src=\"https:\/\/i0.wp.com\/www.rich-hsu.com\/blog\/wp-content\/uploads\/2018\/07\/vim-json-format-after.png?resize=276%2C300&#038;ssl=1\" alt=\"\" width=\"276\" height=\"300\" srcset=\"https:\/\/i0.wp.com\/www.rich-hsu.com\/blog\/wp-content\/uploads\/2018\/07\/vim-json-format-after.png?resize=276%2C300&amp;ssl=1 276w, https:\/\/i0.wp.com\/www.rich-hsu.com\/blog\/wp-content\/uploads\/2018\/07\/vim-json-format-after.png?resize=768%2C834&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rich-hsu.com\/blog\/wp-content\/uploads\/2018\/07\/vim-json-format-after.png?resize=696%2C756&amp;ssl=1 696w, https:\/\/i0.wp.com\/www.rich-hsu.com\/blog\/wp-content\/uploads\/2018\/07\/vim-json-format-after.png?resize=387%2C420&amp;ssl=1 387w, https:\/\/i0.wp.com\/www.rich-hsu.com\/blog\/wp-content\/uploads\/2018\/07\/vim-json-format-after.png?w=779&amp;ssl=1 779w\" sizes=\"(max-width: 276px) 100vw, 276px\" data-recalc-dims=\"1\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>As using VIM to review JSON data, the format and syntax&#8230;<\/p>\n","protected":false},"author":1,"featured_media":56,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[16,29],"tags":[21,31,32,28,30],"post_series":[],"jetpack_featured_media_url":"https:\/\/i2.wp.com\/www.rich-hsu.com\/blog\/wp-content\/uploads\/2018\/07\/json_1530761804.jpg?fit=1280%2C853&ssl=1","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9Qbvu-T","jetpack-related-posts":[{"id":83,"url":"https:\/\/www.rich-hsu.com\/blog\/note-nginx-wordpress-https\/","url_meta":{"origin":55,"position":0},"title":"[Note] Nginx + Wordpress + Https","date":"2019-03-05","format":false,"excerpt":"Days ago, instead of using separate micro\/nano ser\u2026","rel":"","context":"\u5728\u300cBackend\u300d\u4e2d","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.rich-hsu.com\/blog\/wp-content\/uploads\/2019\/03\/https.jpg?fit=1200%2C480&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":37,"url":"https:\/\/www.rich-hsu.com\/blog\/resources-web-developer-check-list\/","url_meta":{"origin":55,"position":1},"title":"[ Resources ] Web developer check list","date":"2018-04-25","format":false,"excerpt":"[] SSL [] Robots [] Backup [] Data firewall [] GA \u2026","rel":"","context":"\u5728\u300cDevelop\u300d\u4e2d","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.rich-hsu.com\/blog\/wp-content\/uploads\/2018\/04\/checklist.jpg?fit=1200%2C800&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":46,"url":"https:\/\/www.rich-hsu.com\/blog\/tools-online-base64-encode-and-decode\/","url_meta":{"origin":55,"position":2},"title":"[ Tools ] Online Base64 Encode and Decode","date":"2018-04-26","format":false,"excerpt":"Sometime we need to encode and decode base64 data.\u2026","rel":"","context":"\u5728\u300cDevelop\u300d\u4e2d","img":{"alt_text":"","src":"https:\/\/i2.wp.com\/www.rich-hsu.com\/blog\/wp-content\/uploads\/2018\/04\/encryption.jpg?fit=1200%2C800&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":98,"url":"https:\/\/www.rich-hsu.com\/blog\/nfc-briefing-quick-notes\/","url_meta":{"origin":55,"position":3},"title":"NFC Briefing - Quick notes","date":"2021-05-04","format":false,"excerpt":"Main Stream Card Type Type Standard Storage Storag\u2026","rel":"","context":"\u5728\u300cNote\u300d\u4e2d","img":{"alt_text":"close up of hand holding text over black background","src":"https:\/\/i0.wp.com\/www.rich-hsu.com\/blog\/wp-content\/uploads\/2021\/05\/pexels-photo-326576.jpeg?fit=1200%2C701&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":31,"url":"https:\/\/www.rich-hsu.com\/blog\/resources-web-developer-toolkit\/","url_meta":{"origin":55,"position":4},"title":"[ Resources ] Web developer toolkit","date":"2018-04-23","format":false,"excerpt":"As web developer, some tools might need.... CC0 Im\u2026","rel":"","context":"\u5728\u300cDevelop\u300d\u4e2d","img":{"alt_text":"","src":"https:\/\/i2.wp.com\/www.rich-hsu.com\/blog\/wp-content\/uploads\/2018\/04\/toolbox.jpg?fit=1200%2C803&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.rich-hsu.com\/blog\/wp-json\/wp\/v2\/posts\/55"}],"collection":[{"href":"https:\/\/www.rich-hsu.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rich-hsu.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rich-hsu.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rich-hsu.com\/blog\/wp-json\/wp\/v2\/comments?post=55"}],"version-history":[{"count":2,"href":"https:\/\/www.rich-hsu.com\/blog\/wp-json\/wp\/v2\/posts\/55\/revisions"}],"predecessor-version":[{"id":60,"href":"https:\/\/www.rich-hsu.com\/blog\/wp-json\/wp\/v2\/posts\/55\/revisions\/60"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rich-hsu.com\/blog\/wp-json\/wp\/v2\/media\/56"}],"wp:attachment":[{"href":"https:\/\/www.rich-hsu.com\/blog\/wp-json\/wp\/v2\/media?parent=55"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rich-hsu.com\/blog\/wp-json\/wp\/v2\/categories?post=55"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rich-hsu.com\/blog\/wp-json\/wp\/v2\/tags?post=55"},{"taxonomy":"post_series","embeddable":true,"href":"https:\/\/www.rich-hsu.com\/blog\/wp-json\/wp\/v2\/post_series?post=55"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}