Parse Json string to Classic ASP page

asp-classic, json, vbscript

Solution

Got it working:

Using https://github.com/rcdmk/aspJSON

Dim jsonString
jsonString = {"date":"4/28/2017","custType":"100","vehicle":"1"}

Dim jsonObj, outputObj
set jsonObj = new JSONobject
set outputObj = jsonObj.parse(jsonString)

response.write("<li> date :" & outputObj("date") & "</li>")
response.write("<li> custType :" & outputObj("custType") & "</li>")
response.write("<li> vehicle :" & outputObj("vehicle") & "</li>")

If you need to iterate through the single object use outputObj.pairs

Dim props, prop
props = outputObj.pairs
for each prop in props
    response.write prop.name & " : " & prop.value & "<br>"
next

as referenced https://github.com/rcdmk/aspJSON/issues/20

Problem

What is the best way to parse json string into classic asp using a library? ``` Dim jsonString jsonString = {"date":"4/28/2017","custType":"100","vehicle":"1"} ``` Would like to have ``` response.write("<li> date :" & json("date") & "</li>") ```

Original source