(Classic ASP) Example: JsonObject.NewArrayOf method
Demonstrates the NewArrayOf method.Note: This example requires Chilkat v11.4.0 or greater.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0
big_cats = "[""lion"",""tiger"",""leopard"",""jaguar"",""cheetah"",""snow leopard"",""clouded leopard"",""cougar"",""puma"",""panther""]"
set json = Server.CreateObject("Chilkat.JsonObject")
success = json.UpdateString("test","abc")
success = json.NewArrayOf("big_cats",big_cats)
If (success = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( json.LastErrorText) & "</pre>"
Response.End
End If
json.EmitCompact = 0
Response.Write "<pre>" & Server.HTMLEncode( json.Emit()) & "</pre>"
' Result:
' {
' "test": "abc",
' "big_cats": [
' "lion",
' "tiger",
' "leopard",
' "jaguar",
' "cheetah",
' "snow leopard",
' "clouded leopard",
' "cougar",
' "puma",
' "panther"
' ]
' }
%>
</body>
</html>
|