title: SequelizeJS - insert JSONB to Postgres with raw query - how to escape
body: <p>I want to insert a row with JSONB content as a raw query. The problem is that I get error wherever I insert any "nontrivial" JSON object.</p>
  
  <p>These are examples of my raw SQL queries:</p>
  
  <p>Error for all of these: SequelizeBaseError: invalid input syntax for type json</p>
  
  <pre><code>'INSERT INTO "sometable" ("id", "createdAt", "updatedAt", "custom_data") VALUES (DEFAULT, NOW(), NOW(), \'"{something:\"value\"}"\')';
  'INSERT INTO "sometable" ("id", "createdAt", "updatedAt", "custom_data") VALUES (DEFAULT, NOW(), NOW(), \'"{\"aaa\":\"ss15\"}"\')';
  </code></pre>
  
  <p>This last one works, but only with integer values:</p>
  
  <pre><code>'INSERT INTO "sometable" ("id", "createdAt", "updatedAt", "custom_data") VALUES (DEFAULT, NOW(), NOW(), \'"{a:10}"\')';
  </code></pre>
  
  <p>I've tried so many possible combinations of escaping the JSON-like string, even inserting real JS object, and nothing worked. </p>