Description: Free Classic ASP component for reading and writing JSON.
free (33108) open source (4644) class (1847) asp (1783) ajax (1254) json (338) classic asp (17) aspjson (2)
The class can be used for reading a string of JSON data as well as writing JSON output from an AJAX file. Below are 2 simple examples of both.
Please feel free to give feedback or report a bug in the github project
<!--#include virtual="/aspJSON1.18.asp" --> <% Set oJSON = New aspJSON 'Load JSON string oJSON.loadJSON(jsonstring) 'Get single value Response . Write oJSON.data( "firstName" ) & "<br>" 'Loop through collection For Each phonenr In oJSON.data( "phoneNumbers" ) Set this = oJSON.data( "phoneNumbers" ). item (phonenr) Response . Write _ this. item ( "type" ) & ": " & _ this. item ( "number" ) & "<br>" Next 'Update/Add value oJSON.data( "firstName" ) = "James" 'Return json string Response . Write oJSON.JSONoutpu