B4X Requires Chilkat v11.4.0+
B4X
Example: JsonObject.NewArrayOf method
See more JSON Examples
Demonstrates theNewArrayOf method.
Chilkat B4X Downloads
Dim success As Boolean = False
Dim big_cats As String = "[" & Chr(34) & "lion" & Chr(34) & "," & Chr(34) & "tiger" & Chr(34) & "," & Chr(34) & "leopard" & Chr(34) & "," & Chr(34) & "jaguar" & Chr(34) & "," & Chr(34) & "cheetah" & Chr(34) & "," & Chr(34) & "snow leopard" & Chr(34) & "," & Chr(34) & "clouded leopard" & Chr(34) & "," & Chr(34) & "cougar" & Chr(34) & "," & Chr(34) & "puma" & Chr(34) & "," & Chr(34) & "panther" & Chr(34) & "]"
Dim json As ChilkatJsonObject
json.Initialize
json.UpdateString("test", "abc")
success = json.NewArrayOf("big_cats", big_cats)
If success = False Then
Log(json.LastErrorText)
Return
End If
json.EmitCompact = False
Log(json.Emit)
' Result:
' {
' "test": "abc",
' "big_cats": [
' "lion",
' "tiger",
' "leopard",
' "jaguar",
' "cheetah",
' "snow leopard",
' "clouded leopard",
' "cougar",
' "puma",
' "panther"
' ]
' }