jsonparser icon indicating copy to clipboard operation
jsonparser copied to clipboard

jsonparser.Delete has different behaviors when key found/not found in json

Open crowfrog opened this issue 4 years ago • 0 comments

when key found in JSON, Delete() will make a new slice and return it with new content. when key not found in JSON, Delete() will return the original slice.

For API user, it is very hard to diff these two cases and make following actions if we want to apply new actions on new slice but not impact original content. If API user make a new slice and copy result of Delete() in it to apply new actions. That means we will take two alloc/copy if the key found in JSON, one by API user and one by Delete().

crowfrog avatar Apr 19 '21 03:04 crowfrog