I want to return a JSON object using a classic ASP script (it\'s part of an AJAX request).
If I just send the reponse as text like:
response.write(\"
It appears to be a parsing error on the client side.
I didn't think this would make a difference, but it looks like if you quote everything, including the property names, it seems to work. And use double-quotes instead of single quotes - that apparently is making a difference.
Remember to double your double-quotes (at least I think that's how you do it in VBScript - been a long time).
So:
<%
Response.ContentType = "application/json"
Response.Write("{ ""query"":""Li"", ""suggestions"":[""Liberia"",""Libyan Arab Jamahiriya"",""Liechtenstein"",""Lithuania""], ""data"":[""LR"",""LY"",""LI"",""LT""] }")
%>