Sample code for 30+ languages & platforms
Tcl

Create JSON Array of Strings

See more JSON Examples

Demonstrates how to create a JSON array of strings.

Chilkat Tcl Downloads

Tcl

load ./chilkat.dll

# The goal of this example is to produce this:

# [
#   "tag1",
#   "tag2",
#   "tag3"
# ]

set jarr [new_CkJsonArray]

CkJsonArray_AddStringAt $jarr -1 "tag1"
CkJsonArray_AddStringAt $jarr -1 "tag2"
CkJsonArray_AddStringAt $jarr -1 "tag3"

CkJsonArray_put_EmitCompact $jarr 0
puts [CkJsonArray_emit $jarr]

delete_CkJsonArray $jarr