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 7916875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:58:05+00:00 2026-06-03T14:58:05+00:00

So in javascript I have an array that looks about like this: [{x1:0,x2:2000,y:300},{x1:50,x2:250,y:500}] And

  • 0

So in javascript I have an array that looks about like this:

[{x1:0,x2:2000,y:300},{x1:50,x2:250,y:500}]

And I would like to store it in a single field in my database. I thought about either somehow making it a string and then saving it as text, but I don’t really know a very efficient and “smart” way to do that. I also heard of the VARBINARY field type, but I have no idea how to write and object/array into one of those and how to read it out…

What I would really most prefer would be if it would automatically be read as an array. My MYSQL-plugin(or however that is called in js) returns my queries as arrays of objects like well:

[{id:0,bla:”text”},{id:0,bla:”text”}]

For a query in a table with the collumns id and bla.

Well say my array is stored in bla, I would like the object I get to look exactly like this right when it is returned(however if that is not possible I am fine with an alternative solution).

[{id:0,bla:[{x1:0,x2:2000,y:300},{x1:50,x2:250,y:500}]},{id:0,bla:[{x1:0,x2:2000,y:300},{x1:50,x2:250,y:500}]}]

So basically I would get an array containing two objects, which each have the properties bla and id, where bla is an array of objects with the properties x1,x2 and y.

  • 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-03T14:58:07+00:00Added an answer on June 3, 2026 at 2:58 pm

    somehow making it a string and then saving it as text, but I don’t really know a very efficient and “smart” way to do that.

    Save the string as JSON, like this:

    var myArr = [{x1:0,x2:2000,y:300},{x1:50,x2:250,y:500}];
    myArrString = JSON.stringify(myArr);
    

    Later, when you get the JSON string back from MySQL, you can turn it back into an array with JSON.parse(), like this:

    var myArr = JSON.parse(myArrString)
    

    And yes, if you’re wondering, JSON functionality has been added to Javascript’s standard codebase: that’s how popular it is.

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

Sidebar

Related Questions

I have a JAVASCRIPT array that looks like this: postarray['min_price'] = 120000; postarray['max_price'] =
I have a Javascript array of 20 RGB color values that looks like this:
I have an array in javascript that looks like this: arr = [md51234,md55234] I'm
Possible Duplicate: Length of Javascript Associative Array I have a JSON that looks like
I have an object in Javascript that looks like this function MyObject(){ this.name=; this.id=0;
I have some javascript that looks like this: var sel = '<option value={value} {selected}>{name}</option>';
I have an array of hashed in Ruby that looks like this: domains =
I have this array, that I want to parse into javascript. $offerText[] = (
I have a collection that looks like: var stuff = new Array(); stuff[col1] =
I have an array in PHP that looks like Array ( [123654] => Array

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.