Adding item to data - json object


#1

Hi
i get posts from wp api and store them in local storage , but i want add item to it manually
the data of my post something like this : item1,item2, … ,item30
myobject json store in local storage and i want add item12 and item3 to my object without loss previous data
i want add some item as bookmark to my object that want store in local storage

tnx


#2

It’s hard to say much because your question is pretty vague, but generally speaking, modifying large JSON objects in storage is something you want to avoid doing, because it’s very inefficient. Try to think of a way of structuring the data so that it is split up to the point where your “modification” can consist of adding a new sub-object with a completely independent key. That way you avoid the overhead of marshalling and unmarshalling other parts.