React Native Requires Chilkat v11.0.0+
React Native
JSON AppendArray2 Example
Demonstrates the AppendArray2 function.Chilkat React Native Downloads
import { JsonArray, JsonObject } from '@chilkat/react-native'
function chilkatExample() {
const json = new JsonObject();
json.load('{ "name": "John", "marbles": 100 }');
// Append an empty array named "xyz"
const jarr = new JsonArray();
json.appendArray2('xyz', jarr);
console.log(json.emit());
// Expected output is: {"name":"John","marbles":100,"xyz":[]}
// Add elements to the array.
jarr.addStringAt(-1, 'hello');
jarr.addIntAt(-1, 256);
console.log(json.emit());
// Expected output is: {"name":"John","marbles":100,"xyz":["hello",256]}
}