title: PostgreSQL: insert data into table from json
body: <p>Now I use to manually parse json into insert string like so</p>
  
  <pre><code>insert into Table (field1, field2) values (val1, val2)
  </code></pre>
  
  <p>but its not comfortable way to insert data from json!
  I've found function json_populate_record and tried to use it:</p>
  
  <pre><code>create table test (id serial, name varchar(50));
  insert into test select * from json_populate_record(NULL::test, '{"name": "John"}');
  </code></pre>
  
  <p>but it fails with the message: null value in column "id" violates not-null constraint
  PG knows that id is serial but pretends to be a fool. Same it do for all fieds with defaults.</p>
  
  <p>Is there more elegant vay to insert data from json into a table?</p>