Sample code for 30+ languages & platforms
Rust

JSON Append String Array

See more JSON Examples

Demonstrates how to append an array of strings from a string table object.

Note: This example uses the AppendStringTable method, which was introduced in Chilkat v9.5.0.67

Chilkat Rust Downloads

Rust
let json = chilkat::JsonObject::new();
json.set_emit_compact(false);

let _ = json.append_string("abc", "123");

let st = chilkat::StringTable::new();
let _ = st.append("a");
let _ = st.append("b");
let _ = st.append("c");
let _ = st.append("d");

let _ = json.append_string_array("strArray", &st);

println!("{}", json.emit().unwrap_or_default());

// Output:

// 	{
// 	  "abc": "123",
// 	  "strArray": [
// 	    "a",
// 	    "b",
// 	    "c",
// 	    "d"
// 	  ]
// 	}