从 json 转换为经典 asp

converting from json to classic asp

我有一个在 js 中运行的原型系统

我使用

调用测试 api
var promise = $.ajax({
    url: "myjson.json",
    method: "post",
    data:data,
    dataType: 'json'
}); 

promise.done(function (result) {
    window[callbackFunction](result);
})

然后将结果传递给回调函数

这将使我能够做类似

的事情
var valid = result.data[0].valid;
var type = result.data[0].type;

我们现在正在更改应用程序以调用一个 asp 页面,可能类似于

<%

  dim result1, dim result2

  valid = "this is a basic test";

  type = "more data"

  dim array(2)

  array(0)= valid
  array(1)= type

  response.write(array)

%>

在asp数组中不会写任何东西。

我想做的是以与之前相同的格式回传

{"valid":"this is a basic test", "type":"moredata"}

这样我就可以在我的 js 应用程序中读取结果

谁能指出我正确的方向?

Classic ASP 没有任何内置支持返回 JSON 序列化数据。为此,您必须依赖第三方解决方案。快速 Google 搜索显示以下选项:

Classic ASP JSON Class