title: Data is getting stored as array of JSON object and not just JSON object in Postgres using TypeORM
body: <p>I'm using TypeORM in my NodeJS function. I have Postgres database where the table column <strong>emp_data</strong> is of type JSON and not JSON[]. But data is getting stored <strong>in the form of array of objects and not just object itself</strong>.</p>
  <p>Here is my logic of passing data :-</p>
  <pre><code>      let emp1 = [{
          &quot;EmployeeID&quot;: &quot;1391&quot;,
          &quot;FirstName&quot;: &quot;Vinod&quot;,
          &quot;LastName&quot;: &quot;Kumar&quot;,
        }];
        let emp2 = [{
          &quot;EmployeeID&quot;: &quot;0827&quot;,
          &quot;FirstName&quot;: &quot;Vijay&quot;,
          &quot;LastName&quot;: &quot;Kumar&quot;,
        }];
  
       const res = await dbConn
          .createQueryBuilder()
          .insert()
          .into(IntegrationData)
          .values(
            { empId: 1391, empData: emp1, integrationName: 'workday'},
            { empId: 0827, empData: emp2, integrationName: 'workday'},
          )
          .execute();
  </code></pre>
  <p>Entity:-</p>
  <pre><code>import { Entity, PrimaryGeneratedColumn, Column, BaseEntity } from &quot;typeorm&quot;;
  
  @Entity({ name: &quot;integration_data&quot; })
  export class IntegrationData extends BaseEntity {
    @PrimaryGeneratedColumn({ type: &quot;bigint&quot; })
    id: number;
  
    @Column({ type: &quot;bigint&quot;, name: &quot;emp_id&quot; })
    empId: number;
  
    @Column({ type: &quot;json&quot;, name: &quot;emp_data&quot; })
    empData: any;
  
    @Column({ name: &quot;integration_name&quot; })
    integrationName: string;
  }
  </code></pre>
  <p>Refer attached screenshot. Data is being stored in the column <strong>emp_data</strong> as array of object.
  <a href="https://i.stack.imgur.com/442NW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/442NW.png" alt="enter image description here" /></a></p>
  <p>I understand that I'm passing emp1 and emp2 as an array of object but the problem is if I convert this emp1 or emp2 to just object then I get compatible issue error (refer attached screenshot).</p>
  <p><a href="https://i.stack.imgur.com/iygB9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iygB9.png" alt="enter image description here" /></a></p>
  <p>Please help me in storing the data as JSON object and not as array of JSON object. Thanks</p>