title: Escape backslash in Angular for the http post call on GraphQL
body: <p>I am trying to save some data using GraphQL which contains backslash in its input in my Angular 5 app.<br>
  For example, while creating a table I want to keep table name as <strong>Indian\Cars</strong></p>
  
  <p>Below is the body of HTTP post call:</p>
  
  <pre><code>{"query":"mutation { createTable(input:[{name:\"Indian\Cars\"}]) { id } }"}
  </code></pre>
  
  <p><strong>Note: name is a string that's the reason I have added \"\" to escape.</strong></p>
  
  <p>But GraphQL is throwing an error:  </p>
  
  <p><strong>'SyntaxError: Unexpected token \' in JSON</strong> </p>
  
  <p>I have tried with replacing it. The table name can be anything, an input from UI.So according to that, I am building the HTTP Post call body dynamically as below.</p>
  
  <pre><code>createGraphQLBodyObjectForPostCall(tableName) {
  
    const newTableName = tableName.replace(/\\/g, '\\\\');
  
    const bodyObject = {"query":"mutation { createTable(input:[{name:\\"' + newTableName + '\\"}]) { id } }"};
  
    return bodyObject;
  }
  </code></pre>
  
  <p>but I want to create the table with the exact same name as <strong>Indian\Cars</strong><br>
  I just want to escape it from the HTTP post-call, but in DB it must save the exact input that we are sending.</p>