React Native Requires Chilkat v11.4.0+
React Native
Example: JsonObject.NewArrayOf method
See more JSON Examples
Demonstrates theNewArrayOf method.
Chilkat React Native Downloads
import { JsonObject } from '@chilkat/react-native'
function chilkatExample() {
const bigCats = '["lion","tiger","leopard","jaguar","cheetah","snow leopard","clouded leopard","cougar","puma","panther"]';
const json = new JsonObject();
json.updateString('test', 'abc');
try {
json.newArrayOf('big_cats', bigCats);
} catch {
console.log(json.lastErrorText);
return;
}
json.emitCompact = false;
console.log(json.emit());
// Result:
// {
// "test": "abc",
// "big_cats": [
// "lion",
// "tiger",
// "leopard",
// "jaguar",
// "cheetah",
// "snow leopard",
// "clouded leopard",
// "cougar",
// "puma",
// "panther"
// ]
// }
}