Modifying a flexbuffers Map after loading from JSON #8351
Replies: 1 comment
|
As far as I know, FlexBuffers does not support in-place modification of an existing A FlexBuffer is essentially a serialized binary structure, and the objects you access through APIs like
would generally require rebuilding part or all of the buffer. So your current approach—reading the existing data and using a The main challenge is that changes can affect offsets, key tables, value storage, and the overall layout of the serialized buffer, making true in-place edits difficult to support in a general way. If you're frequently applying small updates, a couple of alternatives might be worth considering:
I'd be interested to hear if there's an API I've overlooked, but I don't believe FlexBuffers currently provides mutable map semantics after serialization. |
Uh oh!
There was an error while loading. Please reload this page.
I would like to create a flexbuffers Map from a JSON string and then modify some of the elements of that map, including Maps contained within that Map. From what I can tell, the only way to do this is to use a builder to create a new Map that contains both the original Map data and the values I want to add/modify. I've written the code to do this, but my currently implementation is a bit more complicated than I would like, so I wanted to see if there was a simpler way to simply modify a Map.
All reactions