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

119
Vistas
Is it reliable to use nested JSON when using localStorage?

Really confused here. On my current project all data is stored in localStorage, and all objects/arrays have maximum one level of nesting. That results in many inconveniences and even duplicates of the same entities. I decided to refactor the data structure to something more convenient, but also more nested.

Would it be safe and reliable to JSON.stringify() / JSON.parse() back and forth such data? Some of google search results states that json does not support nested arrays, but it does support them! Or..?

what I have now:

    cars: [{id: car1, brand: 'bmw'}, {id: car2, brand: 'ford'}, {id: car3, brand: 'dodge'}]
    car1_details: {id: car1, color: 'blue', horsepower: 150, type: 'coupe'] 
    car2_details: {id: car2, color: 'red', horsepower: 180, type: 'hatchback'] 
    car3_details: {id: car3, color: 'yellow', horsepower: 200, type: 'sedan']

what I obviously want:

    cars: [ 
      {   
        id: car1,    
        brand: 'bmw',   
        details: {     
          color: 'blue',     
          horsepower: 150,     
          type: 'coupe' 
      }
    //etc 
    ]

I tested and it seems to be 100% working, but just wanted to make sure by asking you guys. Also there is this outdated post, but apparently it has been fixed since then.

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