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