jsonparser icon indicating copy to clipboard operation
jsonparser copied to clipboard

The set function does not work

Open fahimbinkhair opened this issue 3 years ago • 0 comments

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

fahimbinkhair avatar Mar 03 '22 12:03 fahimbinkhair