(Classic ASP) JSON Append String Array
Demonstrates how to append an array of strings from a string table object.
Note: This example uses the AppendStringTable method, which was introduced in Chilkat v9.5.0.67
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.JsonObject")
set json = Server.CreateObject("Chilkat.JsonObject")
json.EmitCompact = 0
success = json.AppendString("abc","123")
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.StringTable")
set st = Server.CreateObject("Chilkat.StringTable")
success = st.Append("a")
success = st.Append("b")
success = st.Append("c")
success = st.Append("d")
success = json.AppendStringArray("strArray",st)
Response.Write "<pre>" & Server.HTMLEncode( json.Emit()) & "</pre>"
' Output:
' {
' "abc": "123",
' "strArray": [
' "a",
' "b",
' "c",
' "d"
' ]
' }
%>
</body>
</html>
|