Dart Requires Chilkat v11.4.0+
Dart
Example: JsonObject.NewArrayOf method
See more JSON Examples
Demonstrates theNewArrayOf method.
Chilkat Dart Downloads
import 'package:chilkat/chilkat.dart';
void main() {
final bigCats = '["lion","tiger","leopard","jaguar","cheetah","snow leopard","clouded leopard","cougar","puma","panther"]';
final json = CkJsonObject();
json.updateString('test', 'abc');
try {
json.newArrayOf('big_cats', bigCats);
} on ChilkatException catch (e) {
print(e.lastErrorText);
return;
}
json.emitCompact = false;
print(json.emit());
// Result:
// {
// "test": "abc",
// "big_cats": [
// "lion",
// "tiger",
// "leopard",
// "jaguar",
// "cheetah",
// "snow leopard",
// "clouded leopard",
// "cougar",
// "puma",
// "panther"
// ]
// }
}