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

164
Views
redux - async storage with associative array

I am trying to use associative arrays with redux and to store them in the async storage to retrieve on loading the app.

With redux it works very well I have real quick access to the values and can map the content very well into cards in the react native app.

Now when I store the data in async storage I have to JSON.stringify the content and JSON.parse it back on loading. Unfortunately somehow I cannot use the object the same way afterwards.

my data looks like this:

['1442-3338': { ID: '1442-3338', something: 'something', Participants: [] }, '1442-3339': { ID: '1442-3339', someting: 'something', secondArray: {} }, '1442-3340': { ID: '1442-3340', something: 'something', secondArray: {} }, '1442-3341': { ID: '1442-3341', something: 'something', secondArray: {} } ]

I can access the data via object['1442-3338'], then after storing into the storage and getting it back, which includes JSON.stringify on store and JSON.parse on load, I cannot read the data like that anymore - keys are not recognized.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I found an answer already here on stackoverflow.

JSON does not allow named keys in arrays. Thus on transforming the data via JSON.stringify and JSON.parse the array lost the keys.

Had to use a "normal" object instead, which now works fine.

Link to explanation in another post

about 4 years ago · Juan Pablo Isaza Report
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!