Jump to content

help with json in converting javascript arrays into json strings


s0c0

Recommended Posts

I have a 2 dimensional javascript array, that I want to pass over to a PHP function via Ajax.  When I use the json2.js file located here http://json.org/js.html for implementing json in javascript I don't get a jsonized array at all.  Here is my code:

 

var prodArr =  JSON.stringify(productsArr);

 

I think it is expecting that I am sending it an object.  Prior to this I had been using the json.js file instead of json2.js and it worked fine using the toJsonString method.  Not sure why they took this out of the new json, but I had to start using it since the original json conflicted with the mootools framework.  Did I mention I really hate javascript sometimes and I am tired of typing json.

 

Any help on this?

Link to comment
Share on other sites

From what I'm reading I now have to construct my arrays in an extremely retarded manner looking like this:

 

var a = ["chris"];

 

In order to stringify them.  If someone could show me the syntax for a 2 dimensional array I would be very happy.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.