tidwall / sjson

Set JSON values very quickly in Go
MIT License
2.4k stars 165 forks source link

How to add map to root of JSON? #74

Closed AuroraTea closed 11 months ago

AuroraTea commented 12 months ago
origin := {"a":"a"}
new, err := sjson.Set(origin, "", map[string]any{
    "b": "b",
})

Expect: {"a":"a","b":"b"} but give me an error path cannot be empty

What is the correct way to write it?

natenho commented 11 months ago

@AuroraTea you may take a look at #69, it is the same use case.

AuroraTea commented 11 months ago

@natenho Thanks!!!