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

114
Views
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
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!