title: How do I store an array of json objects with typeorm on postgresql?
body: <p>I have a user entity that is suppose to contain an array of json objects, but I couldn't find a json array type for typeorm to store natively, and I'm not sure how to store them in the database using typeorm.</p>
  <p>The current setup works with typegraphql but it's the typeorm I'm confused about.</p>
  <p>My user entity roughly looks like this:</p>
  <p><code>User.ts</code></p>
  <pre><code>import { Entity, PrimaryGeneratedColumn, Column, BaseEntity, ManyToOne } from &quot;typeorm&quot;;
  import { Field, Int, ObjectType, ID } from &quot;type-graphql&quot;;
  
  
  **//THIS ENTITY**
  @ObjectType()
  export class Softwares {
    @Field(() =&gt; Number)
    id: number;
  
    @Field()
    category: string;
  
    @Field(() =&gt; [String])
    list: string[];
  }
  
  @ObjectType()
  export class About {
    @Field(  { nullable: true } )
    @Column(&quot;text&quot;, { nullable: true })
    about_header_message: string;
  
    **//THIS PART**
    @Field(() =&gt; [Softwares],  { nullable: true })
    softwares: Softwares[];
  
    @Field(() =&gt; [[String]],  { nullable: true })
    @Column(&quot;text&quot;, { nullable: true, array: true })
    info: string[][];
  }
  
  @ObjectType()
  @Entity()
  export class User extends BaseEntity {
    @Field(() =&gt; ID)
    @PrimaryGeneratedColumn()
    id: number;
  
    @Field({ nullable: true })
    @Column(&quot;text&quot;, { nullable: true })
    title_name: string;
  
    @Field({ nullable: true })
    @Column(&quot;text&quot;, { nullable: true })
    first_name: string;
  
    @Field({ nullable: true })
    @Column(&quot;text&quot;, { nullable: true })
    last_name: string;
  
    @Field((type) =&gt; About)
    @Column(() =&gt; About)
    about: About;
  }
  </code></pre>
  <p>Note that the About class is inherited into the normal user entity. I did this because my final GraphQL on a get request should look something like this :</p>
  <pre><code>{
    title_name: &quot;Sky Johnson&quot;,
    first_name: &quot;Sky&quot;,
    last_name: &quot;Johnson&quot;,
    about: {
      about_header_message: &quot;A passionate developer, artist, and photographer&quot;,
      info: [
        [&quot;University&quot;, &quot;University of Colorado Boulder - Cumulative GPA: 3.376&quot;],
        [&quot;Graduation&quot;, &quot;May Class of 2020&quot;],
        [&quot;Degree&quot;, &quot;Computer Science (BS) - Degree GPA: 3.514&quot;],
        [&quot;2nd Degree&quot;, &quot;Creative Technology and Design (BS) - Degree GPA: 3.657&quot;],
        [&quot;Minor&quot;, &quot;Applied Mathematics: Theoretical Statistics&quot;],
        [&quot;Languages&quot;, &quot;English: Native&quot;, &quot;日本語：～N4 University Experience&quot;],
      ],
      softwares: [
        {
          id: 1,
          category: &quot;Favorite Languages&quot;,
          list: [
            &quot;C# + Unity&quot;,
            &quot;Python&quot;,
            &quot;Java&quot;,
            &quot;Scala&quot;,
            &quot;Javascript/Typescript&quot;,
            &quot;C/C++ (limited)&quot;,
            &quot;Processing/Arduino&quot;,
            &quot;OpenSCAD&quot;,
          ],
        },
        {
          id: 2,
          category: &quot;Python Libraries&quot;,
          list: [
            &quot;Tensor Flow&quot;,
            &quot;MatPlotLib&quot;,
            &quot;NetworkX&quot;,
            &quot;Seaborn&quot;,
            &quot;SciKit&quot;,
            &quot;Keras&quot;,
          ],
        },
      ],
    },
  };
  </code></pre>
  <p>I tried using a ManyToOne relation in typeorm on the softwares field in the about type, but I couldn't get it to work since I think the inherited nature of the about class on User is messing it up (since one user can have many softwares objects, but the list of softwares is in the about entity).</p>
  <p>If anyone has any ideas that would help a lot. Thanks!</p>