{"id":979,"date":"2014-01-12T11:00:36","date_gmt":"2014-01-12T16:00:36","guid":{"rendered":"http:\/\/andrewpallant.ca\/wordpress\/?p=979"},"modified":"2014-05-06T22:21:40","modified_gmt":"2014-05-07T02:21:40","slug":"tricking-out-classic-asp-with-json","status":"publish","type":"post","link":"https:\/\/andrewpallant.ca\/wordpress\/tricking-out-classic-asp-with-json\/","title":{"rendered":"Tricking Out Classic ASP With JSON &#8211; Updated"},"content":{"rendered":"<p><em><strong><span style=\"color: red; text-decoration: underline;\">Amendment<\/span>:<\/strong><\/em> \u00a0Some people have had trouble downloading the aspJSON.asp file from the site where I had found it. \u00a0You can <a title=\"aspJSON.asp Download\" href=\"http:\/\/www.unlatched.com\/share\/aspjson.zip\" target=\"_blank\">download<\/a> the file from me.<\/p>\n<p><em><strong><span style=\"color: red; text-decoration: underline;\">Amendment<\/span>:<\/strong><\/em>:  Some people were asking for a solution to Mandrill and SendGrid.  Both solutions are similar and therefore I selected one to publish.  You can contact me if you would like more.  See the following:  <a href=\"http:\/\/andrewpallant.ca\/wordpress\/tricking-classic-asp-json-mandrill-experience\/\">Part II &#8211; The Mandrill Experience<\/a><\/p>\n<p>Sometimes you get trapped in using languages you don&#8217;t prefer. I often find my self playing in the bowels of Classic ASP. Now Classic ASP is not bad, but it is a little outdated and has not really been built upon for a few years. I have recently built some new tools in Classic ASP to compliment an existing tool set; however, I tricked out ASP with JSON.<\/p>\n<p>To do this I had found a wonderful import file written by Gerrit van Kuipers. You can download a copy of the file from: www.aspjson.com. Yes it is version 1.0, but I have not found an issue with it yet.<\/p>\n<p><!--more--><\/p>\n<p>At the very bottom of this article is the the site listed again along with a tool to validate JSON strings.<\/p>\n<p>You will need to import the aspJSON.asp file in your ASP file.<\/p>\n<pre style=\"background-color: f8fcc7; margin-left: 20px; padding: 10px;\">     &lt;!--#include virtual=\"\/aspJSON.asp\" --&gt;<\/pre>\n<p>To read the JSON request you will need to read the binary of the request and convert it to a string.<\/p>\n<pre style=\"background-color: f8fcc7; margin-left: 20px; padding: 10px;\">    If Request.TotalBytes &gt; 0 Then\n        Dim lngBytesCount\n        lngBytesCount = Request.TotalBytes\n        jsonstring = BytesToStr(Request.BinaryRead(lngBytesCount))\n    End If\n\n    Function BytesToStr(bytes)\n        Dim Stream\n        Set Stream = Server.CreateObject(\"Adodb.Stream\")\n            Stream.Type = 1 'adTypeBinary\n            Stream.Open\n            Stream.Write bytes\n            Stream.Position = 0\n            Stream.Type = 2 'adTypeText\n            Stream.Charset = \"iso-8859-1\"\n            BytesToStr = Stream.ReadText\n            Stream.Close\n        Set Stream = Nothing\n    End Function<\/pre>\n<p>Next you will need to create the JSON object to parse it.<\/p>\n<pre style=\"background-color: f8fcc7; margin-left: 20px; padding: 10px;\">     Set oJSON = New aspJSON\n     oJSON.loadJSON(jsonstring)<\/pre>\n<p>Now you can access the data using the JSON object you created in the above step.<\/p>\n<pre style=\"background-color: f8fcc7; margin-left: 20px; padding: 10px;\">     FirstName = oJSON.data.item(\"FirstName\")<\/pre>\n<p><strong>To Write a JSON request you will need to do the following.<\/strong><\/p>\n<p>You will need to import the aspJSON.asp file in your ASP file.<\/p>\n<pre style=\"background-color: f8fcc7; margin-left: 20px; padding: 10px;\">     &lt;!--#include virtual=\"\/aspJSON.asp\" --&gt;<\/pre>\n<p>Next you will need to create the JSON object and populate it<\/p>\n<pre style=\"background-color: f8fcc7; margin-left: 20px; padding: 10px;\">     Set oJSON = New aspJSON\n     set oJSON.data(\"employee\")\n     set newitem = oJSON.addToCollection(oJSON.data(\"employee\"))\n     newitem.add \"FirstName\", \"Andrew\"\n     newitem.add \"LastName\", \"Pallant\"<\/pre>\n<p>Now you can submit your request<\/p>\n<pre style=\"background-color: f8fcc7; margin-left: 20px; padding: 10px;\">     Response.Clear\n     Response.ContentType = \"application\/json\"\n     Response.Write oJSON.JSONoutput()<\/pre>\n<p>You can vist: <a href=\"http:\/\/www.aspjson.com\/\" target=\"new\">http:\/\/www.aspjson.com\/<\/a> for complete example and to download the aspJSON.asp file.<\/p>\n<p>A tool that I use to validate the string file is: <a href=\"http:\/\/jsonformatter.curiousconcept.com\/\" target=\"new\">http:\/\/jsonformatter.curiousconcept.com\/<\/a><\/p>\n<p><strong><span style=\"color: #ff0000;\">Part II of the Article Has Just Been Added<\/span><\/strong>: \u00a0<a title=\"Tricking out Classic ASP with JSON - The Mandrill Experience\" href=\"http:\/\/andrewpallant.ca\/wordpress\/tricking-classic-asp-json-mandrill-experience\/\" target=\"_blank\">http:\/\/andrewpallant.ca\/wordpress\/tricking-classic-asp-json-mandrill-experience\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Amendment: \u00a0Some people have had trouble downloading the aspJSON.asp file from the site where I had found it. \u00a0You can download the file from me. Amendment:: Some people were asking for a solution to Mandrill and SendGrid. Both solutions are similar and therefore I selected one to publish. You can contact me if you would &hellip; <a href=\"https:\/\/andrewpallant.ca\/wordpress\/tricking-out-classic-asp-with-json\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Tricking Out Classic ASP With JSON &#8211; Updated<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[146,141,151,96],"tags":[167,257],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\r\n<title>Tricking Out Classic ASP With JSON - Updated - LDNDeveloper<\/title>\r\n<meta name=\"description\" content=\"Being trapped in Classic ASP doesn&#039;t mean you cannot use JSON calls. Click to read how to trick out Classic ASP with JSON.\" \/>\r\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\r\n<link rel=\"canonical\" href=\"http:\/\/andrewpallant.ca\/wordpress\/tricking-out-classic-asp-with-json\/\" \/>\r\n<meta property=\"og:locale\" content=\"en_US\" \/>\r\n<meta property=\"og:type\" content=\"article\" \/>\r\n<meta property=\"og:title\" content=\"Tricking Out Classic ASP With JSON - Updated - LDNDeveloper\" \/>\r\n<meta property=\"og:description\" content=\"Being trapped in Classic ASP doesn&#039;t mean you cannot use JSON calls. Click to read how to trick out Classic ASP with JSON.\" \/>\r\n<meta property=\"og:url\" content=\"http:\/\/andrewpallant.ca\/wordpress\/tricking-out-classic-asp-with-json\/\" \/>\r\n<meta property=\"og:site_name\" content=\"LDNDeveloper\" \/>\r\n<meta property=\"article:published_time\" content=\"2014-01-12T16:00:36+00:00\" \/>\r\n<meta property=\"article:modified_time\" content=\"2014-05-07T02:21:40+00:00\" \/>\r\n<meta name=\"author\" content=\"ldnDeveloper\" \/>\r\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\r\n<meta name=\"twitter:creator\" content=\"@LdnDeveloper\" \/>\r\n<meta name=\"twitter:site\" content=\"@LdnDeveloper\" \/>\r\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"ldnDeveloper\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\r\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/tricking-out-classic-asp-with-json\/#article\",\"isPartOf\":{\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/tricking-out-classic-asp-with-json\/\"},\"author\":{\"name\":\"ldnDeveloper\",\"@id\":\"https:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/f6f5bb1ac3e0c5a54a8b5ce35fd67b84\"},\"headline\":\"Tricking Out Classic ASP With JSON &#8211; Updated\",\"datePublished\":\"2014-01-12T16:00:36+00:00\",\"dateModified\":\"2014-05-07T02:21:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/tricking-out-classic-asp-with-json\/\"},\"wordCount\":357,\"commentCount\":23,\"publisher\":{\"@id\":\"https:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/f6f5bb1ac3e0c5a54a8b5ce35fd67b84\"},\"keywords\":[\"Classic ASP\",\"JSON\"],\"articleSection\":[\"ASP\",\"Developement\",\"JSON\",\"Web\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\/\/andrewpallant.ca\/wordpress\/tricking-out-classic-asp-with-json\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/tricking-out-classic-asp-with-json\/\",\"url\":\"http:\/\/andrewpallant.ca\/wordpress\/tricking-out-classic-asp-with-json\/\",\"name\":\"Tricking Out Classic ASP With JSON - Updated - LDNDeveloper\",\"isPartOf\":{\"@id\":\"https:\/\/andrewpallant.ca\/wordpress\/#website\"},\"datePublished\":\"2014-01-12T16:00:36+00:00\",\"dateModified\":\"2014-05-07T02:21:40+00:00\",\"description\":\"Being trapped in Classic ASP doesn't mean you cannot use JSON calls. Click to read how to trick out Classic ASP with JSON.\",\"breadcrumb\":{\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/tricking-out-classic-asp-with-json\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/andrewpallant.ca\/wordpress\/tricking-out-classic-asp-with-json\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/tricking-out-classic-asp-with-json\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/andrewpallant.ca\/wordpress\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tricking Out Classic ASP With JSON &#8211; Updated\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/andrewpallant.ca\/wordpress\/#website\",\"url\":\"https:\/\/andrewpallant.ca\/wordpress\/\",\"name\":\"LDNDeveloper\",\"description\":\"Learning, Growing and Sharing.\",\"publisher\":{\"@id\":\"https:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/f6f5bb1ac3e0c5a54a8b5ce35fd67b84\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/andrewpallant.ca\/wordpress\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/f6f5bb1ac3e0c5a54a8b5ce35fd67b84\",\"name\":\"ldnDeveloper\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/andrewpallant.ca\/wordpress\/wp-content\/uploads\/2017\/05\/cropped-AAEAAQAAAAAAAAXQAAAAJDQxMGRlMzFjLWM4ODctNDk1NC05M2EyLWE1NDNhNTRiZjVlYw-2.jpg\",\"contentUrl\":\"https:\/\/andrewpallant.ca\/wordpress\/wp-content\/uploads\/2017\/05\/cropped-AAEAAQAAAAAAAAXQAAAAJDQxMGRlMzFjLWM4ODctNDk1NC05M2EyLWE1NDNhNTRiZjVlYw-2.jpg\",\"width\":512,\"height\":512,\"caption\":\"ldnDeveloper\"},\"logo\":{\"@id\":\"https:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/image\/\"},\"description\":\"Andrew Pallant (@LdnDeveloper) has been a web, database and desktop developer for over 16 years. Andrew has worked on projects that ranged from factory automation to writing business applications. Most recently he has been heavily involved in various forms for ecommerce projects. Over the years Andrew has worn many hats: Project Manager, IT Manager, Lead Developer, Supervisor of Developers and many more - See more at: http:\/\/www.unlatched.com\/#sthash.8DiTkpKy.dpuf\",\"sameAs\":[\"http:\/\/www.andrewpallant.ca\",\"https:\/\/x.com\/LdnDeveloper\"],\"url\":\"https:\/\/andrewpallant.ca\/wordpress\/author\/ldndeveloper\/\"}]}<\/script>\r\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Tricking Out Classic ASP With JSON - Updated - LDNDeveloper","description":"Being trapped in Classic ASP doesn't mean you cannot use JSON calls. Click to read how to trick out Classic ASP with JSON.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/andrewpallant.ca\/wordpress\/tricking-out-classic-asp-with-json\/","og_locale":"en_US","og_type":"article","og_title":"Tricking Out Classic ASP With JSON - Updated - LDNDeveloper","og_description":"Being trapped in Classic ASP doesn't mean you cannot use JSON calls. Click to read how to trick out Classic ASP with JSON.","og_url":"http:\/\/andrewpallant.ca\/wordpress\/tricking-out-classic-asp-with-json\/","og_site_name":"LDNDeveloper","article_published_time":"2014-01-12T16:00:36+00:00","article_modified_time":"2014-05-07T02:21:40+00:00","author":"ldnDeveloper","twitter_card":"summary_large_image","twitter_creator":"@LdnDeveloper","twitter_site":"@LdnDeveloper","twitter_misc":{"Written by":"ldnDeveloper","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/andrewpallant.ca\/wordpress\/tricking-out-classic-asp-with-json\/#article","isPartOf":{"@id":"http:\/\/andrewpallant.ca\/wordpress\/tricking-out-classic-asp-with-json\/"},"author":{"name":"ldnDeveloper","@id":"https:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/f6f5bb1ac3e0c5a54a8b5ce35fd67b84"},"headline":"Tricking Out Classic ASP With JSON &#8211; Updated","datePublished":"2014-01-12T16:00:36+00:00","dateModified":"2014-05-07T02:21:40+00:00","mainEntityOfPage":{"@id":"http:\/\/andrewpallant.ca\/wordpress\/tricking-out-classic-asp-with-json\/"},"wordCount":357,"commentCount":23,"publisher":{"@id":"https:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/f6f5bb1ac3e0c5a54a8b5ce35fd67b84"},"keywords":["Classic ASP","JSON"],"articleSection":["ASP","Developement","JSON","Web"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/andrewpallant.ca\/wordpress\/tricking-out-classic-asp-with-json\/#respond"]}]},{"@type":"WebPage","@id":"http:\/\/andrewpallant.ca\/wordpress\/tricking-out-classic-asp-with-json\/","url":"http:\/\/andrewpallant.ca\/wordpress\/tricking-out-classic-asp-with-json\/","name":"Tricking Out Classic ASP With JSON - Updated - LDNDeveloper","isPartOf":{"@id":"https:\/\/andrewpallant.ca\/wordpress\/#website"},"datePublished":"2014-01-12T16:00:36+00:00","dateModified":"2014-05-07T02:21:40+00:00","description":"Being trapped in Classic ASP doesn't mean you cannot use JSON calls. Click to read how to trick out Classic ASP with JSON.","breadcrumb":{"@id":"http:\/\/andrewpallant.ca\/wordpress\/tricking-out-classic-asp-with-json\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/andrewpallant.ca\/wordpress\/tricking-out-classic-asp-with-json\/"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/andrewpallant.ca\/wordpress\/tricking-out-classic-asp-with-json\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/andrewpallant.ca\/wordpress\/"},{"@type":"ListItem","position":2,"name":"Tricking Out Classic ASP With JSON &#8211; Updated"}]},{"@type":"WebSite","@id":"https:\/\/andrewpallant.ca\/wordpress\/#website","url":"https:\/\/andrewpallant.ca\/wordpress\/","name":"LDNDeveloper","description":"Learning, Growing and Sharing.","publisher":{"@id":"https:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/f6f5bb1ac3e0c5a54a8b5ce35fd67b84"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/andrewpallant.ca\/wordpress\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/f6f5bb1ac3e0c5a54a8b5ce35fd67b84","name":"ldnDeveloper","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/image\/","url":"https:\/\/andrewpallant.ca\/wordpress\/wp-content\/uploads\/2017\/05\/cropped-AAEAAQAAAAAAAAXQAAAAJDQxMGRlMzFjLWM4ODctNDk1NC05M2EyLWE1NDNhNTRiZjVlYw-2.jpg","contentUrl":"https:\/\/andrewpallant.ca\/wordpress\/wp-content\/uploads\/2017\/05\/cropped-AAEAAQAAAAAAAAXQAAAAJDQxMGRlMzFjLWM4ODctNDk1NC05M2EyLWE1NDNhNTRiZjVlYw-2.jpg","width":512,"height":512,"caption":"ldnDeveloper"},"logo":{"@id":"https:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/image\/"},"description":"Andrew Pallant (@LdnDeveloper) has been a web, database and desktop developer for over 16 years. Andrew has worked on projects that ranged from factory automation to writing business applications. Most recently he has been heavily involved in various forms for ecommerce projects. Over the years Andrew has worn many hats: Project Manager, IT Manager, Lead Developer, Supervisor of Developers and many more - See more at: http:\/\/www.unlatched.com\/#sthash.8DiTkpKy.dpuf","sameAs":["http:\/\/www.andrewpallant.ca","https:\/\/x.com\/LdnDeveloper"],"url":"https:\/\/andrewpallant.ca\/wordpress\/author\/ldndeveloper\/"}]}},"_links":{"self":[{"href":"https:\/\/andrewpallant.ca\/wordpress\/wp-json\/wp\/v2\/posts\/979"}],"collection":[{"href":"https:\/\/andrewpallant.ca\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/andrewpallant.ca\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/andrewpallant.ca\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/andrewpallant.ca\/wordpress\/wp-json\/wp\/v2\/comments?post=979"}],"version-history":[{"count":18,"href":"https:\/\/andrewpallant.ca\/wordpress\/wp-json\/wp\/v2\/posts\/979\/revisions"}],"predecessor-version":[{"id":1265,"href":"https:\/\/andrewpallant.ca\/wordpress\/wp-json\/wp\/v2\/posts\/979\/revisions\/1265"}],"wp:attachment":[{"href":"https:\/\/andrewpallant.ca\/wordpress\/wp-json\/wp\/v2\/media?parent=979"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/andrewpallant.ca\/wordpress\/wp-json\/wp\/v2\/categories?post=979"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/andrewpallant.ca\/wordpress\/wp-json\/wp\/v2\/tags?post=979"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}