You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
More examples can be found in the examples subdirectory and further documentation can be found at [godoc](https://pkg.go.dev/github.com/minio/simdjson-go?tab=doc).
267
272
273
+
274
+
### In-place Value Replacement
275
+
276
+
It is possible to replace a few, basic internal values.
277
+
This means that when re-parsing or re-serializing the parsed JSON these values will be output.
278
+
279
+
Boolean (true/false) and null values can be freely exchanged.
280
+
281
+
Numeric values (float, int, uint) can be exchanged freely.
282
+
283
+
Strings can also be exchanged with different values.
284
+
285
+
Strings and numbers can be exchanged. However, note that there is no checks for numbers inserted as object keys,
286
+
so if used for this invalid JSON is possible.
287
+
288
+
There is no way to modify objects, arrays, other than value types above inside each.
289
+
It is not possible to remove or add elements.
290
+
291
+
To replace a value, of value referenced by an `Iter` simply call `SetNull`, `SetBool`, `SetFloat`, `SetInt`, `SetUInt`,
292
+
`SetString` or `SetStringBytes`.
293
+
294
+
### Object & Array Element Deletion
295
+
296
+
It is possible to delete one or more elements in an object.
297
+
298
+
`(*Object).DeleteElems(fn, onlyKeys)` will call back fn for each key+ value.
299
+
300
+
If true is returned, the key+value is deleted. A key filter can be provided for optional filtering.
301
+
If the callback function is nil all elements matching the filter will be deleted.
302
+
If both are nil all elements are deleted.
303
+
304
+
Example:
305
+
306
+
```Go
307
+
// The object we are modifying
308
+
varobj *simdjson.Object
309
+
310
+
// Delete all entries where the key is "unwanted":
311
+
err = obj.DeleteElems(func(key []byte, i Iter) bool {
0 commit comments