[{"data":1,"prerenderedAt":152},["ShallowReactive",2],{"blog-post-jq-pretty-print-json":3,"recent-posts":89},{"id":4,"uid":5,"url":6,"type":7,"href":8,"tags":9,"first_publication_date":10,"last_publication_date":11,"slugs":12,"linked_documents":14,"lang":15,"alternate_languages":16,"data":17},"awgi7hIAACYAhiar","jq-pretty-print-json",null,"blog_posts","https:\u002F\u002Fmarks-personal-website.cdn.prismic.io\u002Fapi\u002Fv2\u002Fdocuments\u002Fsearch?ref=axP1_xMAAC0A2-3W&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22awgi7hIAACYAhiar%22%29+%5D%5D",[],"2026-12-04T22:45:44+0000","2026-12-05T11:31:11+0000",[13],"jq-how-to-pretty-print-json",[],"en-us",[],{"title":18,"date":24,"description":25,"image":30,"content":40},[19],{"type":20,"text":21,"spans":22,"direction":23},"heading1","jq: How to Pretty Print JSON",[],"ltr","2026-12-04",[26],{"type":27,"text":28,"spans":29,"direction":23},"heading2","Learn how to pretty print and format JSON in the terminal with jq",[],{"dimensions":31,"alt":21,"copyright":6,"url":34,"id":35,"edit":36},{"width":32,"height":33},1280,720,"https:\u002F\u002Fimages.prismic.io\u002Fmarks-personal-website\u002Fxva2XoviWFkr0Kkx_jq-pretty-print-json.png?auto=format,compress","xva2XoviWFkr0Kkx",{"x":37,"y":37,"zoom":38,"background":39},0,1,"transparent",[41,45,49,52,55,58,61,64,67,70,86],{"type":42,"text":43,"spans":44,"direction":23},"paragraph","Before we start, make sure you have jq installed on your computer. On a Mac, you can install it with Homebrew:",[],{"type":46,"text":47,"spans":48,"direction":23},"preformatted","brew install jq",[],{"type":42,"text":50,"spans":51,"direction":23},"First, open your terminal and navigate to the folder with your JSON file. To pretty print it, run:",[],{"type":46,"text":53,"spans":54,"direction":23},"jq '.' data.json",[],{"type":42,"text":56,"spans":57,"direction":23},"Just replace \u003Ccode>data.json\u003C\u002Fcode> with your file. The \u003Ccode>.\u003C\u002Fcode> is the identity filter: it passes the whole document through unchanged, and jq prints it with two-space indents, one key per line, and colours. Don't leave the filter out, though. If you run \u003Ccode>jq data.json\u003C\u002Fcode>, jq treats the file name as the filter and you get an error like \u003Ccode>data\u002F0 is not defined\u003C\u002Fcode>.",[],{"type":42,"text":59,"spans":60,"direction":23},"To sort the keys alphabetically, add \u003Ccode>-S\u003C\u002Fcode>. For wider indents, use \u003Ccode>--indent 4\u003C\u002Fcode> or \u003Ccode>--tab\u003C\u002Fcode>.",[],{"type":42,"text":62,"spans":63,"direction":23},"To save the formatted version, redirect it to a new file:",[],{"type":46,"text":65,"spans":66,"direction":23},"jq '.' messy.json > pretty.json",[],{"type":42,"text":68,"spans":69,"direction":23},"jq leaves out the colours when it writes to a file, so \u003Ccode>pretty.json\u003C\u002Fcode> is clean. Open it to make sure everything looks right.",[],{"type":71,"oembed":72},"embed",{"embed_url":73,"type":74,"version":75,"title":21,"author_name":76,"author_url":77,"provider_name":78,"provider_url":79,"thumbnail_url":80,"thumbnail_width":81,"thumbnail_height":82,"html":83,"height":84,"width":85},"https:\u002F\u002Fyoutu.be\u002FCpQz5wBqN2U","video","1.0","markster","https:\u002F\u002Fwww.youtube.com\u002F@markster1904","YouTube","https:\u002F\u002Fwww.youtube.com\u002F","https:\u002F\u002Fi.ytimg.com\u002Fvi\u002FCpQz5wBqN2U\u002Fhqdefault.jpg",480,360,"\u003Ciframe width=\"200\" height=\"113\" src=\"https:\u002F\u002Fwww.youtube.com\u002Fembed\u002FCpQz5wBqN2U?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen title=\"jq: How to Pretty Print JSON\">\u003C\u002Fiframe>",113,200,{"type":42,"text":87,"spans":88,"direction":23},"jq also works on piped text, so you can pipe an API response straight into it: \u003Ccode>curl -s https:\u002F\u002Fapi.example.com\u002Fdata | jq '.'\u003C\u002Fcode>.",[],{"results":90,"page":38,"results_per_page":150,"results_size":150,"total_results_size":151,"total_pages":38},[91,111,130],{"id":92,"uid":93,"url":6,"type":7,"href":94,"tags":95,"first_publication_date":10,"last_publication_date":11,"slugs":96,"linked_documents":98,"lang":15,"alternate_languages":99,"data":100},"awgi0RIAACYAhiZv","ripgrep-replace-text-in-files","https:\u002F\u002Fmarks-personal-website.cdn.prismic.io\u002Fapi\u002Fv2\u002Fdocuments\u002Fsearch?ref=axP1_xMAAC0A2-3W&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22awgi0RIAACYAhiZv%22%29+%5D%5D",[],[97],"how-to-replace-text-in-files-with-ripgrep-and-sed",[],[],{"image":101,"title":107},{"dimensions":102,"alt":103,"copyright":6,"url":104,"id":105,"edit":106},{"width":32,"height":33},"Ripgrep: How to Replace Text in Files with Ripgrep and Sed","https:\u002F\u002Fimages.prismic.io\u002Fmarks-personal-website\u002FOlJ7le5oNEXxcE_I_ripgrep-replace-text-in-files.png?auto=format,compress","OlJ7le5oNEXxcE_I",{"x":37,"y":37,"zoom":38,"background":39},[108],{"type":20,"text":109,"spans":110,"direction":23},"How to Replace Text in Files with Ripgrep and Sed",[],{"id":112,"uid":113,"url":6,"type":7,"href":114,"tags":115,"first_publication_date":10,"last_publication_date":11,"slugs":116,"linked_documents":118,"lang":15,"alternate_languages":119,"data":120},"awgi2hIAACoAhiaF","ripgrep-case-insensitive-search","https:\u002F\u002Fmarks-personal-website.cdn.prismic.io\u002Fapi\u002Fv2\u002Fdocuments\u002Fsearch?ref=axP1_xMAAC0A2-3W&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22awgi2hIAACoAhiaF%22%29+%5D%5D",[],[117],"ripgrep-how-to-search-case-insensitive",[],[],{"image":121,"title":127},{"dimensions":122,"alt":123,"copyright":6,"url":124,"id":125,"edit":126},{"width":32,"height":33},"Ripgrep: How to Search Case Insensitive","https:\u002F\u002Fimages.prismic.io\u002Fmarks-personal-website\u002F6H2DfjROfkSO4wel_ripgrep-case-insensitive-search.png?auto=format,compress","6H2DfjROfkSO4wel",{"x":37,"y":37,"zoom":38,"background":39},[128],{"type":20,"text":123,"spans":129,"direction":23},[],{"id":131,"uid":132,"url":6,"type":7,"href":133,"tags":134,"first_publication_date":10,"last_publication_date":11,"slugs":135,"linked_documents":137,"lang":15,"alternate_languages":138,"data":139},"awgi_hIAACoAhibc","jq-use-with-curl","https:\u002F\u002Fmarks-personal-website.cdn.prismic.io\u002Fapi\u002Fv2\u002Fdocuments\u002Fsearch?ref=axP1_xMAAC0A2-3W&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22awgi_hIAACoAhibc%22%29+%5D%5D",[],[136],"how-to-use-jq-with-curl",[],[],{"image":140,"title":146},{"dimensions":141,"alt":142,"copyright":6,"url":143,"id":144,"edit":145},{"width":32,"height":33},"jq: How to Use jq with curl","https:\u002F\u002Fimages.prismic.io\u002Fmarks-personal-website\u002F3JyqU0cTsv3S-6D0_jq-use-with-curl.png?auto=format,compress","3JyqU0cTsv3S-6D0",{"x":37,"y":37,"zoom":38,"background":39},[147],{"type":20,"text":148,"spans":149,"direction":23},"How to Use 'jq' with 'curl'",[],3,137,1796479490406]