205 B
205 B
1、NewEncoder
writer := bytes.Buffer{}
encoder := json.NewEncoder(&writer)
encoder.SetEscapeHTML(false)
encoder.Encode(struct{ Name string }{Name: "1111"})
jsonStr := writer.String()