title: postgresql text to json conversion
body: <p>I have in the database a table <strong>query_config</strong>, which will contain scripts for querying, as well as other configuration values​​. This is the reason why I use json type. 
  Table as follows:</p>
  
  <pre><code>CREATE TABLE query_config 
  (
     id integer, 
     execute_query json 
  ); 
  </code></pre>
  
  <p>In this table I want to insert eg: </p>
  
  <pre><code>INSERT INTO query_config(id, execute_query)
      VALUES (4, ('{"query": ' || 
      '"select *
      from tests
      where tests.id &gt; 5
      order by moment desc"}')::json);
  </code></pre>
  
  <p>But I keep getting the error: </p>
  
  <pre><code>ERROR: invalid input syntax for type json 
  DETAIL: Character with value 0x0a must be escaped.
  </code></pre>
  
  <p>What am I doing wrong please and how do I escape newline character?</p>