Java
Chilkat2 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.chilkat2.JsonArray;
public class ChilkatExample {
public static void main(String[] args) {
// The goal of this example is to produce this:
// [
// "tag1",
// "tag2",
// "tag3"
// ]
JsonArray jarr = new JsonArray();
jarr.addStringAt(-1, "tag1");
jarr.addStringAt(-1, "tag2");
jarr.addStringAt(-1, "tag3");
jarr.setEmitCompact(false);
System.out.println(jarr.emit());
}
}