Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

307
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda