(VBScript) 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
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.JsonObject")
set json = 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 = CreateObject("Chilkat.StringTable")
success = st.Append("a")
success = st.Append("b")
success = st.Append("c")
success = st.Append("d")
success = json.AppendStringArray("strArray",st)
outFile.WriteLine(json.Emit())
' Output:
' {
' "abc": "123",
' "strArray": [
' "a",
' "b",
' "c",
' "d"
' ]
' }
outFile.Close
|