Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set array of values to the JSON #73

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

lkumarjain
Copy link

In order to be able to set an array of values and do that efficiently we added SetBytesOptionsManyByGetResult() so that all of the values are set at once instead of having to go through the JSON for each value separately. It inserts each value at a specified index maintaining the diff between the original and inserted value, so that the next time the insert happens, the index of the original value will be moved in accordance with the diff.

The other improvement, if you already searched the JSON and have the result of gjson.Get(), then you can just pass it to sjson.Set() instead of having to fire another search inside.

#57

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants