Java
Java
Create JSON Array of Strings
See more JSON Examples
Demonstrates how to create a JSON array of strings.Chilkat Java Downloads
import com.chilkatsoft.*;
public class ChilkatExample {
static {
try {
System.loadLibrary("chilkat");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
// The goal of this example is to produce this:
// [
// "tag1",
// "tag2",
// "tag3"
// ]
CkJsonArray jarr = new CkJsonArray();
jarr.AddStringAt(-1,"tag1");
jarr.AddStringAt(-1,"tag2");
jarr.AddStringAt(-1,"tag3");
jarr.put_EmitCompact(false);
System.out.println(jarr.emit());
}
}