Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

309
Views
TypeORM: convert JSON into typeorm entities

I'm using Nest.JS and TypeORM. I have two entity types: File and Folder (As you can imagine, they represent files and folders on a hard drive).

Example of Folder entity:

    {
        id: 'aaa',
        name: 'home',
        childFolders: [],
        files: []
    }

example of File entity:

    {
        id: 'iii',
        name: 'spreadsheet.csv',
        size: 236434,
    }

I have JSON from a DB which represents filesystem structure structure. For example:

    {
        id: 'aaa',
        name: 'home',
        childFolders: [
            {
                id: 'bbb',
                name: 'bob',
                childFolders: [],
                files: [
                    {
                        id: 'iii',
                        name: 'spreadsheet.csv',
                        size: 236434,
                    }
                ]
            }
        ],
        files: []
    }

I am building an opengraph API to be able to search for files/folders. If I want to convert this JSON into a collection of folder and file entities, will I have to loop recursively and build these entities manually? Or is there an easier way to do that?

Thank you so much for any insight you can provide.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!