Add field to array of object.
sujit-baniya opened this issue · comments
Is it possible to add field in array of object.
package main
import (
"fmt"
"github.com/tidwall/sjson"
)
func main() {
jsondata1 := `{"data":[{"age": 30}, {"age": 35}, {"age": 40}]}`
jsondata1, _ = sjson.Set(jsondata1, "data.[].name", "test")
println(jsondata1)
}
Expected Result
{"data":[{"age": 30, "name": "test"}, {"age": 35, "name": "test"}, {"age": 40, "name": "test"}]}