[{"data":1,"prerenderedAt":149},["ShallowReactive",2],{"blog-post-jq-merge-json-files":3,"recent-posts":86},{"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},"awgjJxIAACsAhicx","jq-merge-json-files",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+%22awgjJxIAACsAhicx%22%29+%5D%5D",[],"2026-12-04T22:45:44+0000","2026-12-05T11:31:11+0000",[13],"jq-how-to-merge-json-files",[],"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 Merge JSON Files",[],"ltr","2026-12-04",[26],{"type":27,"text":28,"spans":29,"direction":23},"heading2","Learn how to merge two or more JSON files 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\u002FXYCKmBXV26G9po8C_jq-merge-json-files.png?auto=format,compress","XYCKmBXV26G9po8C",{"x":37,"y":37,"zoom":38,"background":39},0,1,"transparent",[41,45,49,52,55,58,61,64,67,83],{"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 files. To merge two objects, run:",[],{"type":46,"text":53,"spans":54,"direction":23},"jq -s 'add' file1.json file2.json > merged.json",[],{"type":42,"text":56,"spans":57,"direction":23},"The \u003Ccode>-s\u003C\u002Fcode> flag slurps both files into one array, and \u003Ccode>add\u003C\u002Fcode> merges them from left to right, so the later file wins when a key appears in both. Just be careful: this is a shallow merge. A nested object in the second file replaces the whole object from the first one.",[],{"type":42,"text":59,"spans":60,"direction":23},"For a deep merge that keeps the nested keys, use the \u003Ccode>*\u003C\u002Fcode> operator inside \u003Ccode>reduce\u003C\u002Fcode>:",[],{"type":46,"text":62,"spans":63,"direction":23},"jq -s 'reduce .[] as $item ({}; . * $item)' file1.json file2.json > merged.json",[],{"type":42,"text":65,"spans":66,"direction":23},"You can pass as many files as you like, or a wildcard like \u003Ccode>*.json\u003C\u002Fcode>. Open \u003Ccode>merged.json\u003C\u002Fcode> to make sure every setting is there.",[],{"type":68,"oembed":69},"embed",{"embed_url":70,"type":71,"version":72,"title":21,"author_name":73,"author_url":74,"provider_name":75,"provider_url":76,"thumbnail_url":77,"thumbnail_width":78,"thumbnail_height":79,"html":80,"height":81,"width":82},"https:\u002F\u002Fyoutu.be\u002FZVixkjGv-i8","video","1.0","markster","https:\u002F\u002Fwww.youtube.com\u002F@markster1904","YouTube","https:\u002F\u002Fwww.youtube.com\u002F","https:\u002F\u002Fi.ytimg.com\u002Fvi\u002FZVixkjGv-i8\u002Fhqdefault.jpg",480,360,"\u003Ciframe width=\"200\" height=\"113\" src=\"https:\u002F\u002Fwww.youtube.com\u002Fembed\u002FZVixkjGv-i8?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 Merge JSON Files\">\u003C\u002Fiframe>",113,200,{"type":42,"text":84,"spans":85,"direction":23},"If both files hold arrays of objects that share an \u003Ccode>id\u003C\u002Fcode>, you can join them: \u003Ccode>jq -s 'add | group_by(.id) | map(add)' file1.json file2.json\u003C\u002Fcode>.",[],{"results":87,"page":38,"results_per_page":147,"results_size":147,"total_results_size":148,"total_pages":38},[88,108,127],{"id":89,"uid":90,"url":6,"type":7,"href":91,"tags":92,"first_publication_date":10,"last_publication_date":11,"slugs":93,"linked_documents":95,"lang":15,"alternate_languages":96,"data":97},"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",[],[94],"how-to-replace-text-in-files-with-ripgrep-and-sed",[],[],{"image":98,"title":104},{"dimensions":99,"alt":100,"copyright":6,"url":101,"id":102,"edit":103},{"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},[105],{"type":20,"text":106,"spans":107,"direction":23},"How to Replace Text in Files with Ripgrep and Sed",[],{"id":109,"uid":110,"url":6,"type":7,"href":111,"tags":112,"first_publication_date":10,"last_publication_date":11,"slugs":113,"linked_documents":115,"lang":15,"alternate_languages":116,"data":117},"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",[],[114],"ripgrep-how-to-search-case-insensitive",[],[],{"image":118,"title":124},{"dimensions":119,"alt":120,"copyright":6,"url":121,"id":122,"edit":123},{"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},[125],{"type":20,"text":120,"spans":126,"direction":23},[],{"id":128,"uid":129,"url":6,"type":7,"href":130,"tags":131,"first_publication_date":10,"last_publication_date":11,"slugs":132,"linked_documents":134,"lang":15,"alternate_languages":135,"data":136},"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",[],[133],"how-to-use-jq-with-curl",[],[],{"image":137,"title":143},{"dimensions":138,"alt":139,"copyright":6,"url":140,"id":141,"edit":142},{"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},[144],{"type":20,"text":145,"spans":146,"direction":23},"How to Use 'jq' with 'curl'",[],3,137,1796479490572]