sjson_test.go 352 B

1234567891011121314151617181920
  1. package yu_json
  2. import "testing"
  3. func TestSet(t *testing.T) {
  4. var json = `{"name":{"first":"Janet","last":"Prichard"},"age":47}`
  5. json = Set(json, "name.last", "Anderson")
  6. println(json)
  7. json = Set(json, "age.aaaaa", "Anderson")
  8. println(json)
  9. json = Set(json, "agse.0", 123)
  10. println(json)
  11. json = Set(json, "agse.10", 123)
  12. println(json)
  13. }