title: MYSQL: Invalid JSON text: "Invalid escape character in string."
body: <p>I'm trying to insert a JSON object into a MySQL JSON column and I'm getting: <code>Invalid JSON text: "Invalid escape character in string."</code></p>
  
  <p>The offending character is the <code>\n</code> in this part of the object:</p>
  
  <p><code>"summary":"Summary of Qualifications:\nAccomplished and results-driven General Business Director with a consistent track record."</code></p>
  
  <p>I've tried JSON.stringify, JSON_OBJECT, JSON_QUOTE, and my most recent attempts included:</p>
  
  <p><code>summary.replace("\n", "\\n")</code> and variations on replacing the existing escape characters with proper? escape characters.</p>
  
  <p>I'm using Node, Express and JawsDB if that may have any bearing.</p>
  
  <p>EDIT: Here's the actual insert code:</p>
  
  <pre><code>const fields = '(myField)';
  const values = `('${JSON.stringify(field.contents || {})}')`;
  db.query('INSERT INTO mydb ' + fields + ' VALUES ' + values,
      err =&gt; { 
          if (err) {
              console.log(values);
              throw(err) ;
          }
      }
  );
  </code></pre>