the following parameters are passed in:
[{
"id": "02c76c921d5011e987c600163e0e2174",
"code": "02c76c921d5011e987c600163e0e2174",
"fullTitle": "test,test-t",
"parentId": "e8bbcff61d4f11e987c600163e0e2174",
"_checked": false,
"isChecked": false,
"selected": false,
"hovered": false,
"expanded": true,
"load": true,
"parent": {
"id": "e8bbcff61d4f11e987c600163e0e2174",
"code": "e8bbcff61d4f11e987c600163e0e2174",
"fullTitle": "test",
"parentId": 0,
"_checked": false,
"isChecked": false,
"children": [null, {
"id": "2473dea61d5011e987c600163e0e2174",
"code": "2473dea61d5011e987c600163e0e2174",
"fullTitle": "test,test-e",
"parentId": "e8bbcff61d4f11e987c600163e0e2174",
"_checked": false,
"isChecked": false,
"selected": false,
"hovered": false,
"expanded": true,
"load": true,
"level": 2,
"isShow": true,
"spaceHtml": "<i class="ms-tree-space"></i>",
"hasChildren": false,
"sort": "34",
"seq": 2,
"isLabelShow": true,
"isInputShow": false,
"showInput": false,
"type": "editSort"
}],
"selected": false,
"hovered": false,
"expanded": true,
"load": true,
"parent": null,
"level": 1,
"isShow": true,
"spaceHtml": "",
"hasChildren": true,
"sort": 401,
"seq": 6,
"isLabelShow": true,
"isInputShow": false,
"showInput": false
},
"level": 2,
"isShow": true,
"spaceHtml": "<i class="ms-tree-space"></i>",
"hasChildren": false,
"sort": "234",
"seq": 1,
"isLabelShow": true,
"isInputShow": false,
"showInput": false,
"type": "editSort"
}, {
"id": "02c76c921d5011e987c600163e0e2174",
"code": "02c76c921d5011e987c600163e0e2174",
"fullTitle": "test,test-e",
"parentId": "e8bbcff61d4f11e987c600163e0e2174",
"_checked": false,
"isChecked": false,
"selected": false,
"hovered": false,
"expanded": true,
"load": true,
"parent": {
"id": "e8bbcff61d4f11e987c600163e0e2174",
"code": "e8bbcff61d4f11e987c600163e0e2174",
"fullTitle": "test",
"parentId": 0,
"_checked": false,
"isChecked": false,
"children": [null, {
"id": "2473dea61d5011e987c600163e0e2174",
"code": "2473dea61d5011e987c600163e0e2174",
"fullTitle": "test,test-e",
"parentId": "e8bbcff61d4f11e987c600163e0e2174",
"_checked": false,
"isChecked": false,
"selected": false,
"hovered": false,
"expanded": true,
"load": true,
"level": 2,
"isShow": true,
"spaceHtml": "<i class="ms-tree-space"></i>",
"hasChildren": false,
"sort": "34",
"seq": 2,
"isLabelShow": true,
"isInputShow": false,
"showInput": false,
"type": "editSort"
}],
"selected": false,
"hovered": false,
"expanded": true,
"load": true,
"parent": null,
"level": 1,
"isShow": true,
"spaceHtml": "",
"hasChildren": true,
"sort": 401,
"seq": 6,
"isLabelShow": true,
"isInputShow": false,
"showInput": false
},
"level": 2,
"isShow": true,
"spaceHtml": "<i class="ms-tree-space"></i>",
"hasChildren": false,
"sort": "234",
"seq": 1,
"isLabelShow": true,
"isInputShow": false,
"showInput": false,
"type": "editSort"
}, {
"id": "35f29a5e1d5011e987c600163e0e2174",
"code": "35f29a5e1d5011e987c600163e0e2174",
"fullTitle": "test-sun,test-u",
"parentId": "f24bd87b1d4f11e987c600163e0e2174",
"_checked": false,
"isChecked": false,
"selected": true,
"hovered": false,
"expanded": true,
"load": true,
"parent": {
"id": "f24bd87b1d4f11e987c600163e0e2174",
"code": "f24bd87b1d4f11e987c600163e0e2174",
"fullTitle": "test-sun",
"parentId": 0,
"_checked": false,
"isChecked": false,
"children": [null, {
"id": "0ef954591d5011e987c600163e0e2174",
"code": "0ef954591d5011e987c600163e0e2174",
"fullTitle": "test-sun,test-s",
"parentId": "f24bd87b1d4f11e987c600163e0e2174",
"_checked": false,
"isChecked": false,
"selected": false,
"hovered": false,
"expanded": true,
"load": true,
"level": 2,
"isShow": true,
"spaceHtml": "<i class="ms-tree-space"></i>",
"hasChildren": false,
"sort": "456",
"seq": 2,
"isLabelShow": false,
"isInputShow": true,
"showInput": false,
"type": "editSort"
}],
"selected": false,
"hovered": false,
"expanded": true,
"load": true,
"parent": null,
"level": 1,
"isShow": true,
"spaceHtml": "",
"hasChildren": true,
"sort": 402,
"seq": 7,
"isLabelShow": true,
"isInputShow": false,
"showInput": false
},
"level": 2,
"isShow": true,
"spaceHtml": "<i class="ms-tree-space"></i>",
"hasChildren": false,
"sort": "454",
"seq": 1,
"isLabelShow": true,
"isInputShow": false,
"showInput": false,
"type": "editSort"
}, {
"id": "02c76c921d5011e987c600163e0e2174",
"code": "02c76c921d5011e987c600163e0e2174",
"fullTitle": "test,test-n",
"parentId": "e8bbcff61d4f11e987c600163e0e2174",
"_checked": false,
"isChecked": false,
"selected": false,
"hovered": false,
"expanded": true,
"load": true,
"parent": {
"id": "e8bbcff61d4f11e987c600163e0e2174",
"code": "e8bbcff61d4f11e987c600163e0e2174",
"fullTitle": "test",
"parentId": 0,
"_checked": false,
"isChecked": false,
"children": [null, {
"id": "2473dea61d5011e987c600163e0e2174",
"code": "2473dea61d5011e987c600163e0e2174",
"fullTitle": "test,test-e",
"parentId": "e8bbcff61d4f11e987c600163e0e2174",
"_checked": false,
"isChecked": false,
"selected": false,
"hovered": false,
"expanded": true,
"load": true,
"level": 2,
"isShow": true,
"spaceHtml": "<i class="ms-tree-space"></i>",
"hasChildren": false,
"sort": "34",
"seq": 2,
"isLabelShow": true,
"isInputShow": false,
"showInput": false,
"type": "editSort"
}],
"selected": false,
"hovered": false,
"expanded": true,
"load": true,
"parent": null,
"level": 1,
"isShow": true,
"spaceHtml": "",
"hasChildren": true,
"sort": 401,
"seq": 6,
"isLabelShow": true,
"isInputShow": false,
"showInput": false
},
"level": 2,
"isShow": true,
"spaceHtml": "<i class="ms-tree-space"></i>",
"hasChildren": false,
"sort": "234",
"seq": 1,
"isLabelShow": true,
"isInputShow": false,
"showInput": false,
"type": "editSort"
}]
let str = JSON.stringify (pd, function (key: any, value: any) {
if (typeof value === "object" && value !== null) {
if (cache.indexOf(value) !== -1) {
return;
}
cache.push(value);
}
return value;
});
is used to convert the above code. The
result should return an array with four objects, but two of them become null. Solve! Thank you!
[{
"id": "02c76c921d5011e987c600163e0e2174",
"code": "02c76c921d5011e987c600163e0e2174",
"fullTitle": "test,test-t",
"parentId": "e8bbcff61d4f11e987c600163e0e2174",
"_checked": false,
"isChecked": false,
"selected": false,
"hovered": false,
"expanded": true,
"load": true,
"parent": {
"id": "e8bbcff61d4f11e987c600163e0e2174",
"code": "e8bbcff61d4f11e987c600163e0e2174",
"fullTitle": "test",
"parentId": 0,
"_checked": false,
"isChecked": false,
"children": [null, {
"id": "2473dea61d5011e987c600163e0e2174",
"code": "2473dea61d5011e987c600163e0e2174",
"fullTitle": "test,test-e",
"parentId": "e8bbcff61d4f11e987c600163e0e2174",
"_checked": false,
"isChecked": false,
"selected": false,
"hovered": false,
"expanded": true,
"load": true,
"level": 2,
"isShow": true,
"spaceHtml": "<i class="ms-tree-space"></i>",
"hasChildren": false,
"sort": "34",
"seq": 2,
"isLabelShow": true,
"isInputShow": false,
"showInput": false,
"type": "editSort"
}],
"selected": false,
"hovered": false,
"expanded": true,
"load": true,
"parent": null,
"level": 1,
"isShow": true,
"spaceHtml": "",
"hasChildren": true,
"sort": 401,
"seq": 6,
"isLabelShow": true,
"isInputShow": false,
"showInput": false
},
"level": 2,
"isShow": true,
"spaceHtml": "<i class="ms-tree-space"></i>",
"hasChildren": false,
"sort": "234",
"seq": 1,
"isLabelShow": true,
"isInputShow": false,
"showInput": false,
"type": "editSort"
},
null,
{
"id": "35f29a5e1d5011e987c600163e0e2174",
"code": "35f29a5e1d5011e987c600163e0e2174",
"fullTitle": "test-sun,test-u",
"parentId": "f24bd87b1d4f11e987c600163e0e2174",
"_checked": false,
"isChecked": false,
"selected": true,
"hovered": false,
"expanded": true,
"load": true,
"parent": {
"id": "f24bd87b1d4f11e987c600163e0e2174",
"code": "f24bd87b1d4f11e987c600163e0e2174",
"fullTitle": "test-sun",
"parentId": 0,
"_checked": false,
"isChecked": false,
"children": [null, {
"id": "0ef954591d5011e987c600163e0e2174",
"code": "0ef954591d5011e987c600163e0e2174",
"fullTitle": "test-sun,test-s",
"parentId": "f24bd87b1d4f11e987c600163e0e2174",
"_checked": false,
"isChecked": false,
"selected": false,
"hovered": false,
"expanded": true,
"load": true,
"level": 2,
"isShow": true,
"spaceHtml": "<i class="ms-tree-space"></i>",
"hasChildren": false,
"sort": "456",
"seq": 2,
"isLabelShow": false,
"isInputShow": true,
"showInput": false,
"type": "editSort"
}],
"selected": false,
"hovered": false,
"expanded": true,
"load": true,
"parent": null,
"level": 1,
"isShow": true,
"spaceHtml": "",
"hasChildren": true,
"sort": 402,
"seq": 7,
"isLabelShow": true,
"isInputShow": false,
"showInput": false
},
"level": 2,
"isShow": true,
"spaceHtml": "<i class="ms-tree-space"></i>",
"hasChildren": false,
"sort": "454",
"seq": 1,
"isLabelShow": true,
"isInputShow": false,
"showInput": false,
"type": "editSort"
}, null]