React Native Requires Chilkat v11.0.0+
React Native
Copy JSON Object from one JSON Array to Another
See more JSON Examples
Demonstrates how to copy an object in a JSON array to another JSON array.Chilkat React Native Downloads
import { JsonArray, JsonObject } from '@chilkat/react-native'
function chilkatExample() {
const arr1 = new JsonArray();
const arr2 = new JsonArray();
const s = '[{"a":1}, {"b":2}, {"c":3}]';
const sEmpty = '[]';
arr1.load(s);
arr2.load(sEmpty);
const jObj = new JsonObject();
arr1.objectAt2(1, jObj);
arr2.addObjectCopyAt(-1, jObj);
console.log(arr2.emit());
// output is: [{"b":2}]
}