JSON parsing by ASP

Source: Internet
Author: User

<% Dim sc4json sub initscriptcontrol set sc4json = server. createobject ("msscriptcontrol. scriptcontrol ") sc4json. language = "JavaScript" sc4json. addcode "Var itemtemp = NULL; function getjsarray (ARR, index) {itemtemp = arr [Index];}" End sub function getjsonobject (strjson) sc4json. addcode "Var jsonobject =" & strjson set getjsonobject = sc4json. codeobject. jsonobject end Function Sub getjsarrayitem (objdest, objjsarray, index) on error resume next sc4json. run "getjsarray", objjsarray, index set objdest = sc4json. codeobject. itemtemp if err. number = 0 Then exit sub objdest = sc4json. codeobject. itemtemp end sub dim strtest = "{name:" "alonely" ", age: 24, email: [" "ycplxl1314@163.com" "," "ycplxl1314@gmail.com" "], family: {parents: ["" Father "", "" Mother ""], tostring: function () {return "" family member "";}}} "dim objtest call initscriptcontrol set objtest = getjsonobject (strtest) %> <% = objtest. the email address of name %> is <% = sc4json. eval ("jsonobject. email [0] ") %> <br> total email addresses <% = objtest. email. length %> <br> <% dim father getjsarrayitem father, objtest. family. parents, 0 response. write Father %>

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.