ojg
ojg copied to clipboard
Cannot delete from array?
package main
import (
"fmt"
"github.com/ohler55/ojg"
"github.com/ohler55/ojg/jp"
"github.com/ohler55/ojg/sen"
)
func main() {
data := map[string]any{"a": 1, "b": []any{0, 1, "2", 3, 4, 5}, "c": 3}
if err := jp.MustParseString("$.b[2]").Del(data); err != nil {
panic(err)
}
fmt.Println(sen.String(data, &ojg.Options{Sort: true}))
}
I would have expected the output to be:
{a:1 b:[0 1 3 4 5] c:3}
But instead it is
{a:1 b:[0 1 null 3 4 5] c:3}
Is this a misunderstanding on my part or a bug?