Dan
Dan

Reputation: 1295

converting from json to classic asp

I have a prototype system that is working in js

I call an test api using

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

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

this then passes the result to the callback function

which would enable me to do something like

var valid = result.data[0].valid;
var type = result.data[0].type;

we are now changing the application to call an asp page which maybe something like

<%

  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)

%>

In asp array will not write anything.

What I want to do is passback in the same format as before something like

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

So that I can read in the result in my js application

can anyone point me in the right direction?

Upvotes: 0

Views: 1396

Answers (1)

Justin Niessner
Justin Niessner

Reputation: 245449

Classic ASP doesn't have anything built-in to support returning JSON Serialized data. You'll have to rely on a third party solution for that. A quick Google search shows the following as an option:

Classic ASP JSON Class

Upvotes: 1

Related Questions