I have a JSON data structure as shown below:
{
\"name\": \"World\",
\"children\": [
{ \"name\": \"US\",
\"children\": [
{
You could use a function like this :
function clonerename(source) {
if (Object.prototype.toString.call(source) === '[object Array]') {
var clone = [];
for (var i=0; i
Note that what you have isn't a JSON data structure (this doesn't exist as JSON is a data-exchange format) but probably an object you got from a JSON string.