JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.1/jquery.js"></script>
JavaScript
var test1 = {
"text": "As",
"icon": "icons/tree.png",
"children": [
{
"text": "Class1",
"children": [
{
"text": "Intern1",
"-ORDER": "2",
"children": [
{
"name": "--TRT",
"text": "Name of Intern"
}
]
},
{
"text": "Intern2",
"-ORDER": "2",
"children": [
{
"name": "--TRT",
"text": "Name of Intern"
}
]
}
]
}
]}
var test2 = {
"text": "As",
"icon": "icons/tree.png",
"children": [
{
"text": "Class2",
"children": [
{
"text": "Intern3",
"-ORDER": "2",
"children": [
{
"name": "--TRT",
"text": "Name of Intern"
}
]
},
{
"text": "Intern4",
"-ORDER": "2",
"children": [
{
"name": "--TRT",
"text": "Name of Intern"
}
]
}
]
}
]
}
$.when(test1, test2)
.then(function (a,b) {
//return $.extend(a, b);
console.log($.extend(true, a, b));
});