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

  • SEARCH
  • Home
  • 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 8145299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:37:14+00:00 2026-06-06T13:37:14+00:00

I am trying to store a multi dimensional (2 dimension) array in JavaScript phonegap

  • 0

I am trying to store a multi dimensional (2 dimension) array in JavaScript phonegap using localstorage.setitem

However, it seems to convert the array into a single dimension.

Is there any way to maintain the array structure when stored locally?

Thanks.

  • 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-06-06T13:37:17+00:00Added an answer on June 6, 2026 at 1:37 pm

    I had the same problem and I used the following solution to make it work:

    var a1 = [1,2,3];
    var b1 = [4,5,6];
    var c1 = [7,8,9];
    var a = [a1, b1, c1];
    localStorage.setItem("arr", JSON.stringify(a));
    var b = JSON.parse(localStorage.getItem("arr"));
    

    By default, localStorage only supports strings as storage formats. You can’t store results of JavaScript computations that are arrays or objects, and every number is stored as a string – http://24ways.org/2010/html5-local-storage.
    ​

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

Sidebar

Related Questions

Essentially, I'm trying to store user input in a multi dimensional array using for
I'm trying to convert a two-dimensional array to a string in order to store
When I'm trying to store all <a> elements as objects in array (using $('a')
I am trying to store an array and manipulate that array using a custom
I have an app that shows store sales. It is a multi-dimensional array, so
I am trying to store sub-query result in session variable using MySQL, but the
I'm trying to store a very large string which I will ultimately convert to
I am trying to store my public and private keys in a container using
I am using ExcelDNA/C#/Excel primarily. What I am essentially trying to do is convert
I have discovered an issue when trying to store a lot of keys using

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.