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

The set function does not work #242

Open
fahimbinkhair opened this issue Mar 3, 2022 · 0 comments
Open

The set function does not work #242

fahimbinkhair opened this issue Mar 3, 2022 · 0 comments

Comments

@fahimbinkhair
Copy link

fahimbinkhair commented Mar 3, 2022

data := []byte({
"person": {
"name": {
"first": "Leonid",
"last": "Bugaev",
"fullName": "Leonid Bugaev"
},
"github": {
"handle": "buger",
"followers": 109
},
"avatars": [
{ "url": "https://avatars1.githubusercontent.com/u/14009?v=3&s=460", "type": "thumbnail" }
]
},
"company": {
"name": "Acme"
}
}`)

x, err := jsonparser.Set(data, []byte("http://github.com"), "person", "avatars", "[0]", "url")
if err == nil {
	log.Println(err.Error())
}

`

The code above gives error: runtime error: invalid memory address or nil pointer dereference

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

No branches or pull requests

1 participant