JSFiddle - React, Tailwind, and code Playground

JavaScript

require(["dojox/json/ref"], function() {
function arm(pobj) {
    this.id = pobj.id;
    this.parent = pobj.parent;
    this.otherChar = pobj.otherChar;
    this.toJSON = function() {
        return "ARM";
    };


}
function leg(pobj) {
    this.id = pobj.id;
    this.parent = pobj.parent;
    this.otherChar = pobj.otherChar;
    this.toJSON = function() {
        return "leg";
    };
}

function person(pobj) {
    this.id = pobj.id;
    this.parent = pobj.parent;
    this.otherChar = pobj.otherChar;
    this.Arms = [];
    this.Legs = [];

    this.Arms[this.Arms.length] = new arm({
        id: 1,
        parent: this,
        otherChar: "First"
    });
    this.Arms[this.Arms.length] = new arm({
        id: 2,
        parent: this,
        otherChar: "Second"
    });
    this.Legs[this.Legs.length] = new leg({
        id: 1,
        parent: this,
        otherChar: "First"
    });
    this.Legs[this.Legs.length] = new leg({
        id: 1,
        parent: this,
        otherChar: "Second"
    });

    this.toJSON = function() {
        return "Person";
    };
}



var group = [];
alert("asdasd");
group[group.length] = new person({
    id: 1,
    parent: this,
    otherChar: "first"
});
group[group.length] = new person({
    id: 2,
    parent: this,
    otherChar: "second"
});

alert(group);
    var pgroup = group;
    var jsonMe = dojox.json.ref.toJson(pgroup); // serialize me
    alert(jsonMe);
});