jsonparser.Delete doesn't handle line breaks comma
Houlton opened this issue ยท 3 comments
Houlton commented
Hi,
data := []byte(
{
"key1": "v1"
,
"key2": "v2"
}`)
newData := jsonparser.Delete(data, "key1")
fmt.Println(string(newData))
`
In the output, an extra comma exists, which is not a valid json.
{
,
"key2", "v2"
}
Houlton commented
Hi,
Please anyone answer this issue?
AllenX2018 commented
@Houlton I didn't reproduce your issue.
andersfylling commented
@AllenX2018 that is because you aren't using new lines.
https://play.golang.org/p/DD67y0rgT0r
You need to compact the json first: https://play.golang.org/p/YL4fD0KxFHU
It would be great if this lib could support a in-place compacter.