I have array of object tree
var tree = [{
"id": "1",
"name": "one",
"child": [],
}, {
"id": "2",
"name": "two",
"child": [{
"id": "21",
"name": "twentyOne",
"child": [],
},{
"id": "22",
"name": "twentyTwo",
"child": [],
}],
}, {{
"id": "3",
"name": "three",
"child": [],
},
}].
Which one is the best way to store array of objects in localStorage
?
Is it better to use another format?
There are several methods:
- getItem
- getAllItem
- removeItem
- saveItem
But there are child arrays of objects. It means that I will use recursive search to find necessary object.