Classic ASP server-side JSON library

dreftymac picture dreftymac · Feb 18, 2010 · Viewed 13.7k times · Source

I have inherited some Classic ASP code and I need a JSON library that can be instantiated and run server-side for use with JavaScript-coded server-side ASP.

How can I do this?

Answer

Cheeso picture Cheeso · Mar 9, 2012

In my experience, JSON2.js works in Classic ASP.

To use it, I do this in the .asp code:

<%@ language="Javascript" %>

<script language="javascript" runat="server" src='json2.js'></script>

<script language="javascript" runat="server">

   ... my code here....

   // use the JSON object:
   var jsonRepresentation = JSON.stringify(myObject, null, 2);

</script>