title: How to escape quotes in a JSON value with JQ when JSON is not valid yet
body: <p>I have invalid JSON like this:</p>
  
  <pre><code>{
     "a": "value1",
     "b": "value2",
     "c": "value3"
  }
  {
     "a": "value4",
     "b": "value5",
     "c": "value6"
  }
  {
     "a": "value7",
     "b": "value8",
     "c": "value9"
  }
  </code></pre>
  
  <p>I can easily make it valid with JQ -- <code>jq . -s</code> -- which outputs:</p>
  
  <pre><code>[
     {
         "a": "value1",
         "b": "value2",
         "c": "value3"
     },
     {
         "a": "value4",
         "b": "value5",
         "c": "value6"
     },
     {
         "a": "value7",
         "b": "value8",
         "c": "value9"
     }
  ]
  </code></pre>
  
  <p>But when my invalid JSON contains quotes...</p>
  
  <pre><code>{
     "a": "value1",
     "b": "value with "quotes"2",
     "c": "value with "more" than one set of "quotes"3"
  }
  {
     "a": "value4",
     "b": "value with "quotes"5",
     "c": "value with "more" than one set of "quotes"6"
  }
  {
     "a": "value7",
     "b": "value with "quotes"8",
     "c": "value with "more" than one set of "quotes"9"
  }
  </code></pre>
  
  <p>...that JQ command obviously won't work because of the quotes within quotes.</p>
  
  <p>My goal is to make my original JSON completely valid both in (1) structure and  (2) with quotes in values escaped. I don't want any other quotes escaped than those inside the value -- for example:</p>
  
  <p><code>"c": "value with \"more\" than one set of \"quotes\"9",</code></p>
  
  <p>I have written a number of one-off Bash sed scripts to search and replace unescaped quotes with escaped quotes, but as use cases grow so do the number of scripts. It seems like JQ may be powerful and elegant enough to handle a use case like this, if I knew how to use JQ better.</p>
  
  <p>I have tried various combinations of JQ's slurp, raw input, and raw output functions. All I accomplish is switching back and forth between everything escaped or my original problematic JSON. <code>c</code> is the only key whose value will ever have quotes within it.</p>
  
  <p>There may also be another solution besides sed or JQ that addresses this in a wise way. A command-line solution is ideal, because I don't know C#, Java, or JavaScript. Python might be acceptable if there is simply no way to accomplish it with JQ.</p>
  
  <p>Thank you for any help or ideas.</p>