LDNDeveloper

Andrew Pallant

Software & Web Developer


Donate To Support My Blog Donate if this post helped you. Coffee money is always welcomed!




Tricking Out Classic ASP With JSON – The Mandrill Experience

Physical Link: Tricking Out Classic ASP With JSON – The Mandrill Experience


Using JSON with Classic ASP can be a tricky thing, but the developer of ASPJSON has made it very easy.  This library ( or include ) has made my life so much easier, but the instructions to get me started was somewhat raw and difficult for me to follow.

Since my original posting about  Tricking Out Classic ASP with JSON, I have had several people ask for the solution to SendGrid and Mandrill.  Both systems are very different, but the principals are similar.  I found Mandrill the easiest to implement.

The following code is the magic to it all, but this example is specific to Mandrill.

   jsonstring = ""  

   If Request.TotalBytes > 0 Then   
     Dim lngBytesCount   
     lngBytesCount = Request.TotalBytes   
     jsonstring = BytesToStr(Request.BinaryRead(lngBytesCount))   
   End If   

   Set oJSON = New aspJSON  
   'Load JSON string  
   jsonstring = replace(jsonstring, "mandrill_events=","")  
   oJSON.loadJSON(URLDecode(jsonstring))  

 ' Loop Through Records  
 for i = 0 to oJSON.data.count -1  
   str = oJSON.data(i).item("event")  
   straddress = oJSON.data(i).item("msg").item("email")  
 next  

You can download the full code sample from:  https://www.andrewpallant.ca/sample/Mandrill%20with%20Classic%20ASP/mandrill%20aspjson%20testing.zip

I did include the ASPJSON include file so that you would get the complete solution; but you should ensure you have the latest once you have my example working.  Goto ASPJSON to get the latest library.

The post Tricking Out Classic ASP With JSON – The Mandrill Experience appeared first on LDNDeveloper.

Author:
Categories: ASP, JSON, Web, Classic ASP, Mandrill, SendGrid, vbScript


©2024 LdnDeveloper