Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any good libraries for parsing JSON in Classic ASP? [closed]

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)

Can anyone recommend a library for parsing JSON in Classic ASP?

like image 831
Mark Biek Avatar asked Jun 19 '09 17:06

Mark Biek


People also ask

What is the best JSON parser?

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.

Is JSON parsing slow?

parse: 702 ms. Clearly JSON. parse is the slowest of them, and by some margin.

What is JSON parse in Ruby?

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.


1 Answers

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 %> 
like image 59
Chris Nielsen Avatar answered Sep 24 '22 23:09

Chris Nielsen