Rust
Rust
Create JSON Array of Strings
See more JSON Examples
Demonstrates how to create a JSON array of strings.Chilkat Rust Downloads
// The goal of this example is to produce this:
// [
// "tag1",
// "tag2",
// "tag3"
// ]
let jarr = chilkat::JsonArray::new();
let _ = jarr.add_string_at(-1, "tag1");
let _ = jarr.add_string_at(-1, "tag2");
let _ = jarr.add_string_at(-1, "tag3");
jarr.set_emit_compact(false);
println!("{}", jarr.emit().unwrap_or_default());