我已经在classic ASP(VBScript)中找到了无数用于generating个JSON的库,但我在parsing个中没有找到任何库.
我想要一些可以传递JSON字符串并返回某种类型的VBScript对象(数组、脚本、字典等)的东西
我已经在classic ASP(VBScript)中找到了无数用于generating个JSON的库,但我在parsing个中没有找到任何库.
我想要一些可以传递JSON字符串并返回某种类型的VBScript对象(数组、脚本、字典等)的东西
Keep in mind that Classic ASP includes JScript as well as VBScript. Interestingly, you can parse JSON using JScript and use the resulting objects directly in VBScript.
Therefore, it is possible to use the canonical https://github.com/douglascrockford/JSON-js/blob/master/json2.js in server-side code with zero modifications.
Of course, if your JSON includes any arrays, these will remain JScript arrays when parsing is complete. You can access the contents of the JScript array from VBScript using dot notation.
<%@Language="VBScript" %>
<%
Option Explicit
%>
<script language="JScript" runat="server" src='path/to/json2.js'></script>
<%
Dim myJSON
myJSON = Request.Form("myJSON") // "[ 1, 2, 3 ]"
Set myJSON = JSON.parse(myJSON) // [1,2,3]
Response.Write(myJSON) // 1,2,3
Response.Write(myJSON.[0]) // 1
Response.Write(myJSON.[1]) // 2
Response.Write(myJSON.[2]) // 3
%>