How to convert a multidimensional array of JSON into a multi-dimensional array of JS

Source: Internet
Author: User
How to convert a multidimensional array of JSON into a multi-dimensional array of JS
PHP Code
  
  


JScript Code
  
   $.getjson (".. /php/json.php?parm=arr2 ", function (JSON) {//The middle should be how to write});


The final JS if it is
JScript Code
  
   var arr1=["A", "B", "C"];        var arr2=[                ["A1", "A2", "A3"],                ["B1", "B2", "B3"],                ["C1", "C2", "C3"]        ];        var arr3=[                 [                    ["A11", "A12", "A13"],                    ["A21", "A22", "A23"],                    ["A31", "A32", "A33"]                 ],                 [                    ["B11", "B12", "B13"],                    ["B21", "B22", "B23"],                    ["B31", "B32", "B33"]                 ],                 [                    ["C11", "C12", "C13"],                    ["C21", "C22", "C23" ],                    ["C31", "C32", "C33"]                 ]        ;


------Solution--------------------
JS is not so familiar with, so I want to know is actually passed JSON to JS, but also to restore the group to do?
------Solution--------------------
JQuery's Getjson method has converted the received data into an array of JSON objects
Meaning JSON in function (JSON) is an array of JSON objects
You can already use the json.name directly.
Under normal circumstances, the end is exhausted.

Look at your description, it seems to be to construct a global variable from it
You can walk through each of these members with a for (k in JSON), and use the Eval function to import them into global variables.
Of course the variable name you have to construct yourself, because your PHP code is not outgoing
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.