title: Can't import a JSON-formatted table into PostgreSQL
body: <p>I've read the article &quot;<a href="https://stackoverflow.com/questions/39224382/how-can-i-import-a-json-file-into-postgresql?noredirect=1&amp;lq=1">How can I import a JSON file into PostgreSQL?</a>&quot;
  I've been trying to create a table from Query Tool, but I keep getting an error message and I am a bit lost why I get the syntax error in where other people don't...
  (I tried to ask  a question in the post above, but I'm too new to make a comment on others' post.)</p>
  <p>I'd appreciate it if anyone can give me a hint on how to fix this.</p>
  <p><strong>The query I use</strong></p>
  <pre><code>with customer_json (doc) as (
      values
      ('[
    {
     &quot;consecutive&quot;:&quot;1&quot;,
     &quot;ticket&quot;:&quot;#7457512&quot;,
     &quot;category&quot;:&quot;Temp&gt;Support&gt;Rule&quot;,
     &quot;question&quot;:&quot;Can I ask another question?&quot;,
     &quot;answer&quot;:&quot;answer1 yes, but only if it''s related?&quot;,
     &quot;url&quot;:&quot;https://tools.team.com/inbox/ticket/7457512&quot;,
     &quot;note&quot;:&quot;テスト&quot;,
    },
  
    {
     &quot;consecutive&quot;:&quot;2&quot;,
     &quot;ticket&quot;:&quot;#4408539-2&quot;,
     &quot;category&quot;:&quot;Automation&gt;WF / List&quot;,
     &quot;question&quot;:\&quot;not equal\&quot; vs \&quot;not contain\&quot;,
     &quot;answer&quot;:&quot;answer2  filter not any vs not all of them&quot;,
     &quot;url&quot;:&quot;https://tools.team.com/inbox/ticket/4408539&quot;,
     &quot;note&quot;:&quot;-&quot;,
    },
  
    {
     &quot;consecutive&quot;:&quot;3&quot;,
     &quot;ticket&quot;:&quot;#4204223-2&quot;,
     &quot;category&quot;:&quot;Temp&gt;Investigation&gt;JIRA / Temp&gt;Investigation&gt;Sharing&quot;,
     &quot;question&quot;:&quot;Thank you for sharing. Will start investigation with related teams&quot;,
     &quot;answer&quot;:&quot;answer3 will let you know asap&quot;,
     &quot;url&quot;:&quot;https://tools.team.com/inbox/ticket/4204223&quot;,
     &quot;note&quot;:&quot;#7457512&quot;,
    },
  
    {
     &quot;consecutive&quot;:&quot;4&quot;,
     &quot;ticket&quot;:&quot;#4223184&quot;,
     &quot;category&quot;:&quot;Temp&gt;Close&gt;Bug&quot;,
     &quot;question&quot;:&quot;[NOT fixed] When the bug won''t be fixed for a while&quot;,
     &quot;answer&quot;:&quot;answer4 apologies about the bug with the filter&quot;,
     &quot;url&quot;:&quot;https://tools.team.com/inbox/ticket/4223184&quot;,
     &quot;note&quot;:&quot;-&quot;,
    },
  
    {
     &quot;consecutive&quot;:&quot;5&quot;,
     &quot;ticket&quot;:&quot;#6462310&quot;,
     &quot;category&quot;:&quot;Form / Forum&quot;,
     &quot;question&quot;:&quot;[TempSQL&gt;Upgade/Additional] How to conduct a questionaire / customer survey&quot;,
     &quot;answer&quot;:&quot;answer5 \r\nNew line&quot;,
     &quot;url&quot;:&quot;https://tools.team.com/inbox/ticket/6462310&quot;,
     &quot;note&quot;:&quot;#7457512&quot;,
    },
  
    {
     &quot;consecutive&quot;:&quot;6&quot;,
     &quot;ticket&quot;:&quot;#4321892&quot;,
     &quot;category&quot;:&quot;Automation&gt;WF&quot;,
     &quot;question&quot;:&quot;*confirming *&quot;,
     &quot;answer&quot;:&quot;answer6 あいうえお&quot;,
     &quot;url&quot;:&quot;https://tools.team.com/inbox/ticket/4321892&quot;,
     &quot;note&quot;:&quot;-&quot;,
    }
  ]'::json)
  )
  insert into customer (consecutive, ticket, category, question, answer, url, note)
  select p.*
  from customer_json l
    cross join lateral json_populate_recordset(null::customer, doc) as p
  on conflict (id) do update 
    set consecutive = excluded.consecutive,
        ticket = excluded.ticket,
        category = excluded.category,
        question = excluded.question,
        answer = excluded.answer,
        url = excluded.url,
        note = excluded.note;
  </code></pre>
  <p><strong>The response / error message</strong></p>
  <blockquote>
  <pre><code>ERROR:  invalid input syntax for type json
  LINE 3:     ('[
               ^
  DETAIL:  Expected string, but found &quot;}&quot;.
  CONTEXT:  JSON data, line 8: ...inbox/ticket/7457512&quot;,
     &quot;note&quot;:&quot;テスト&quot;,
    }...
  SQL state: 22P02
  Character: 47
  </code></pre>
  </blockquote>
  <p><strong>Others</strong>
  For some reason, I'd like to paste a JSON-formatted table into the query tool.</p>
  <p>My original data is created as an Excel file, so I use formulas to format the table as a JSON style.</p>