rcdmk / aspJSON

A fast classic ASP JSON parser and encoder for easy JSON manipulation to work with the new JavaScript MV* libraries and frameworks.
MIT License
203 stars 89 forks source link

Parsing Json to ASP #44

Closed RaviRamDhali closed 7 years ago

RaviRamDhali commented 7 years ago

I have a Json object posted to an asp page.

I need to parse the json object and get each key/property.

Code example (not working)

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>")

Microsoft VBScript runtime error '800a01b6' Object doesn't support this property or method: 'date '

How can I get the key/value from the Json String some way?

RaviRamDhali commented 7 years ago

Working Code:

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