func BenchmarkChanson(b *testing.B) { lo := buildLargeObject(b.N) b.ResetTimer() cs := New(ioutil.Discard) cs.Object(func(obj Object) { for k, v := range lo { obj.Set(k, v) } }) }
func ExampleObject() { buf := bytes.NewBuffer(nil) cs := New(ioutil.Discard) cs.Object(func(obj Object) { obj.Set("foo", "bar") obj.Set("fun", func(enc *json.Encoder) { enc.Encode([]int{1, 2, 3}) }) }) fmt.Printf("%v", buf.String()) }