B4X Requires Chilkat v11.0.0+
B4X
JSON AppendArray2 Example
Demonstrates the AppendArray2 function.Chilkat B4X Downloads
Dim json As ChilkatJsonObject
json.Initialize
json.Load("{ " & Chr(34) & "name" & Chr(34) & ": " & Chr(34) & "John" & Chr(34) & ", " & Chr(34) & "marbles" & Chr(34) & ": 100 }")
' Append an empty array named "xyz"
Dim jarr As ChilkatJsonArray
jarr.Initialize
json.AppendArray2("xyz", jarr)
Log(json.Emit)
' Expected output is: {"name":"John","marbles":100,"xyz":[]}
' Add elements to the array.
jarr.AddStringAt(-1, "hello")
jarr.AddIntAt(-1, 256)
Log(json.Emit)
' Expected output is: {"name":"John","marbles":100,"xyz":["hello",256]}