I've been able to find a zillion libraries for generating JSON in Classic ASP (VBScript) but I haven't been to find ANY for parsing.
I want something that I can pass a JSON string and get back a VBScript object of some sort (Array, Scripting.Dictionary, etc)
1. Jackson. Jackson is a multi-purpose Java library for processing JSON data format. Jackson aims to be the best possible combination of fast, correct, lightweight, and ergonomic for developers.
parse: 702 ms. Clearly JSON. parse is the slowest of them, and by some margin.
JavaScript Object Notation, or JSON for short, is a simple and incredibly lightweight data exchange format. JSON is easy to write and read both for machines and humans. JSON is everywhere, and it is used to transfer structured data over the network with a major application in APIs.
Keep in mind that Classic ASP includes JScript as well as VBScript. Interestingly, you can parse JSON using JScript and use the resulting objects directly in VBScript.
Therefore, it is possible to use the canonical https://github.com/douglascrockford/JSON-js/blob/master/json2.js in server-side code with zero modifications.
Of course, if your JSON includes any arrays, these will remain JScript arrays when parsing is complete. You can access the contents of the JScript array from VBScript using dot notation.
<%@Language="VBScript" %> <% Option Explicit %> <script language="JScript" runat="server" src='path/to/json2.js'></script> <% Dim myJSON myJSON = Request.Form("myJSON") // "[ 1, 2, 3 ]" Set myJSON = JSON.parse(myJSON) // [1,2,3] Response.Write(myJSON) // 1,2,3 Response.Write(myJSON.[0]) // 1 Response.Write(myJSON.[1]) // 2 Response.Write(myJSON.[2]) // 3 %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With