title: editing a JSON file with sed
body: <p>I need to edit a JSON file, using <code>sed</code>, to add some data in to the file. The JSON is as follows:</p>
  
  <pre><code>{
    'name':
    // more attributes that are already filled in 
  }
  </code></pre>
  
  <p>I have written this <code>sed</code> command to try and do it:</p>
  
  <pre><code>sed "s/(\'name\':)/\1\"hello\"\,/g" /path/to/file.json
  </code></pre>
  
  <p>However, I keep getting this error:</p>
  
  <pre><code>sed: \1 not defined in the RE
  </code></pre>
  
  <p>The expected results are:</p>
  
  <pre><code>{
    'name': "hello",
    // more attributes here, left untouched
  }
  </code></pre>
  
  <p>I know this is a bad way of doing it, but I don't think I am able to use tools such as <a href="http://stedolan.github.io/jq/" rel="nofollow"><code>jq</code></a> because the file will be edited on a server and I cannot install <code>jq</code> on the server. If anyone has a better solution i'd be very interested to hear it. Thank you!</p>