aspjson.asp download from this link
[INPUT]
{
“firstName”: “John”,
“lastName” : “Smith”,
“age” : 25,
“address” :
{
“streetAddress”: “21 2nd Street”,
“city” : “New York”,
“state” : “NY”,
“postalCode” : “10021″
},
“phoneNumber”:
[
{
"type" : "home",
"number": "212 555-1234"
},
{
"type" : "fax",
"number": "646 555-4567"
}
]
}
<!–#include virtual=”/aspJSON.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 subItem In oJSON.data(“address”)
Response.Write subItem & “: ” & _
oJSON.data(“address”).item(subItem) & “<br>”
Next
‘Update/Add value
oJSON.data(“firstName”) = “James”
‘Return the object
Response.Write oJSON.JSONoutput()
%>
[INPUT]
{
“firstName”: “John”,
“lastName” : “Smith”,
“age” : 25,
“address” :
{
“streetAddress”: “21 2nd Street”,
“city” : “New York”,
“state” : “NY”,
“postalCode” : “10021″
},
“phoneNumber”:
[
{
"type" : "home",
"number": "212 555-1234"
},
{
"type" : "fax",
"number": "646 555-4567"
}
]
}
<!–#include virtual=”/aspJSON.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 subItem In oJSON.data(“address”)
Response.Write subItem & “: ” & _
oJSON.data(“address”).item(subItem) & “<br>”
Next
‘Update/Add value
oJSON.data(“firstName”) = “James”
‘Return the object
Response.Write oJSON.JSONoutput()
%>