 <p><code>ed</code> is the standard text editor.</p> <pre><code>#!/bin/bash { ed -s file.json &lt;&lt;EOF /\"fruit\": \[ a { "fruit":"apple" , "amount":"10" } #object to add . wq EOF } &amp;&gt; /dev/null </code></pre> <p>Don't know why you want to use bash for that, though, there are much better tools around!</p> <p>Done.</p>