Open
Description
i have an implementation of jsonparser for marshaling/appending data to a json structure from a struct, but
anytime i use Set() it return a data type that is not json, but looks like a javascript object.
heres my code:
package main
import (
"github.com/buger/jsonparser"
"fmt"
)
type Layout struct {
One string `json:"one"`
}
//INCOMPLETE!!
func (l Layout) LayoutSerializer() []byte {
var ref []byte
ref = []byte(`{"one": "",`)
store,_ := jsonparser.Set(ref, []byte(l.One), "one")
return store
}
func main() {
d := Layout{One:"hello wrld",}
collect := d.LayoutSerializer()
fmt.Println(string(collect))
}
//outputs:
/*{"one": hello wrld,}*/
//instead of:
/* {"one":" hello wrld",} */
what is wrong here cause i cant parse this output as its not recognized as json data!!.
Metadata
Metadata
Assignees
Labels
No labels