title: How to insert json data into postgres database table
body: <p>I m a beginner and trying to insert JSON values into the database using a tutorial</p>
  <p>I have created the table using the following command</p>
  <pre><code>CREATE TABLE table_name( id character varying(50),
                           data json NOT NULL,
                           active boolean NOT NULL,
                           created_at timestamp with time zone NOT NULL,
                           updated_at timestamp with time zone NOT NULL,
                           CONSTRAINT table_name_pkey PRIMARY KEY (id)
                         );
  </code></pre>
  <p>The table is created with table_name.</p>
  <p>Now I am trying to insert the values into the database:</p>
  <pre><code>INSERT INTO table_name
  SELECT id,data,active,created_at,updated_at
  FROM json_populate_record (NULL::table_name,
       '{
          &quot;id&quot;: &quot;1&quot;,
          &quot;data&quot;:{
                  &quot;key&quot;:&quot;value&quot;
                  },
           &quot;active&quot;:true,
           &quot;created_at&quot;: SELECT NOW(),
           &quot;updated_at&quot;: SELECT NOW()
         }'
    );
  </code></pre>
  <p>It throws the following error</p>
  <p>ERROR: Invalid input syntax for type JSON '{</p>
  <p>Could anyone help me to resolve and insert the JSON values into the DB?</p>