Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4616936
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:03:12+00:00 2026-05-22T02:03:12+00:00

With the following JSON: var myObj = {name: ‘my obj’, does: ‘nothing’}; var myObjArr

  • 0

With the following JSON:

var myObj = {name: 'my obj', does: 'nothing'};
var myObjArr = [myObj, myObj, myObj];

When storing myObjArr to local storage, the myObj JSON is wrtten 3 times, taking up 3 times as much storage space, i.e:

"[{"name":"my obj","does":"nothing"},{"name":"my obj","does":"nothing"},{"name":"my obj","does":"nothing"}]"

Obviously this is going to present scalability issues. Can anyone recommend an optimal solution? So far I’ve had to resort to using ID’s, a la relational databases.

var objects = {0: {name: 'my obj', does: 'nothing'}};
var myObjArr = [{obj: 0}, {obj: 0}, {obj: 0}];

Update – the question is how to represent this hierarchy in local storage when all data is ultimately stored as key/value strings. Resorting to relational database concepts seems old-school.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:03:13+00:00Added an answer on May 22, 2026 at 2:03 am

    A more appropriate technology would be IndexedDB used as an object store, however it isn’t supported by many browsers yet.

    EDIT: You’ll want to browse through the documentation of the structured clone algorithm that is used when copying an object into IndexedDB – it looks like references are maintained per record, but adding multiple records will not result in each record referencing objects that were shared in the JavaScript memory space.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm storing JSON formatted data into a var adds with the following methods: var
I am using the following method to basically create a JSON string. var saveData
I have the following json array of objects in my code var groups =
I have the following JavaScript array of real estate home objects: var json =
Example: The following string is defined in a json.js file. var test = One
I've got the following JSON structure that defines a table and it's data. var
I have the following JSON: {workspace: { name:Dallas, dataStores:http://.....:8080/geoserver/rest/workspaces/Dallas/datastores.json, coverageStores:http://.....:8080/geoserver/rest/workspaces/Dallas/coveragestores.json, wmsStores:http://....:8080/geoserver/rest/workspaces/Dallas/wmsstores.json}} And I´m trying
I have the following JSON: validate = { '(\\.org|\\.info|\\.biz|\\.name)$': [ { 'type': 'size', 'pattern':
I have the following json output when i call a sample webservice <string>[{Name:Ajay Singh,Company:Birlasoft
I have the following JSON String. var jsonString = '{J:4,0:M, J:5,0:N}' If I parse

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.