JSFiddle - React, Tailwind, and code Playground
JavaScript
var mainObj = {
"97483": {
"_index": 0,
"text_html": "sadf"
},
"97484": {
"_index": 1,
"text_html": "sfhsdfasdfsdf"
},
"97485": {
"_index": 2,
"text_html": "test1"
},
"97486": {
"_index": 3,
"text_html": "test2"
},
"97487": {
"_index": 4,
"text_html": "test3"
},
"97493": {
"_index": 0,
"text_html": "test9"
},
"97494": {
"_index": 1,
"text_html": "test10"
},
"97495": {
"_index": 2,
"text_html": "test11"
},
"97496": {
"_index": 3,
"text_html": "test11"
},
"97893": {
"_index": 0,
"text_html": "test99"
},
"97894": {
"_index": 1,
"text_html": "test999"
},
"97895": {
"_index": 2,
"text_html": "test9999"
}
};
var result = {};
Object.keys(mainObj).forEach(function(itm){
if(mainObj[itm]._index == 0) result = {};
result[itm] = mainObj[itm];
});
alert(JSON.stringify(result));