ASP Json Parser correction version _json

Source: Internet
Author: User
Tags json javascript array
But later, when used, found a problem, if the JSON is simple, there is no problem, if the JSON contains an array, because the VBS is not directly referencing the elements of the array in JS, so the array elements in the JSON object can not be accessed. Tried a lot of ways, pop, and so on, No. Search the net again, also have no fruit.
Depressed for a long time, instead of searching "VBScript how to access JavaScript array", I found a foreigner article. After debugging, found the foreigner's method is good. The reason for not being able to access is that the corresponding get method is not defined. Instead, join him in the get indexer, try it, OK.
The code is as follows:
ASP JSON parser
Code
Copy Code code as follows:

<script language= "javascript" runat= "Server" >
Array.prototype.get = function (prop)
{
return This[prop];
}

function Parsetojson (json_data)
{
Eval ("var o=" + json_data);
Return (o);
}
</script>
Related Article

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.