ASP can also process JSON data? Haha, I just saw an article written by a brother on the Pjblog forum. There was no test, but theoretically it must be possible~ It's too late, no test.
It was too troublesome to deal with JSON in the past, and the output was okay, just loop it up, and parsing was really a headache. So when encountering this kind of problem, API problems are usually handled in XML. I don’t like it very much, which is very troublesome.
<%Dim sc4Json Sub InitScriptControlSet 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.jsonObjectEnd 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. itemTempEnd Sub Dim strTeststrTest = {name:alonely, age:24, email:[[email protected],[email protected]], family:{parents:[father, mother],toString:function(){return family member;}}}Dim objTestCall InitScriptControlSet objTest = getJSONObject(strTest)% The email address of ><%=objTest.name%> is < %=sc4Json.Eval(jsonObject.email[0])%><br />There are total email addresses < %=objTest.email.length%><br / ><%Dim fathergetJSArrayItem father, objTest.family.parents, 0Response.Write father%>More articles related to ASP processing JSON can be read on.