title: Using \COPY to load CSV with JSON fields into Postgres
body: <p>I'm attempting to load TSV data from a file into a Postgres table using the \COPY command.</p>
  
  <p>Here's an example data row:</p>
  
  <pre><code>2017-11-22 23:00:00     "{\"id\":123,\"class\":101,\"level\":3}"
  </code></pre>
  
  <p>Here's the psql command I'm using:</p>
  
  <pre><code>\COPY bogus.test_table (timestamp, sample_json) FROM '/local/file.txt' DELIMITER E'\t'
  </code></pre>
  
  <p>Here's the error I'm receiving:</p>
  
  <pre><code>ERROR:  invalid input syntax for type json
  DETAIL:  Token "sample_json" is invalid.
  CONTEXT:  JSON data, line 1: "{"sample_json...
  COPY test_table, line 1, column sample_json: ""{\"id\":123,\"class\":101,\"level\":3}""
  </code></pre>
  
  <p>I verified the JSON is in the correct JSON format and read a couple similar questions, but I'm still not sure what's going on here. An explanation would be awesome</p>