json 序列化特殊字符不转义
This commit is contained in:
parent
5c584bcb76
commit
25bed80472
10
json.go
10
json.go
@ -70,8 +70,9 @@ func (oj *ownJSON) UnmarshalWithNumberForString(input string, receiver interface
|
|||||||
//
|
//
|
||||||
// Date : 21:56 2023/7/22
|
// Date : 21:56 2023/7/22
|
||||||
func (oj *ownJSON) MarshalForByte(input interface{}) []byte {
|
func (oj *ownJSON) MarshalForByte(input interface{}) []byte {
|
||||||
byteData, _ := json.Marshal(input)
|
buffer := bytes.NewBuffer([]byte{})
|
||||||
return byteData
|
_ = json.NewEncoder(buffer).Encode(input)
|
||||||
|
return buffer.Bytes()
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalForString 序列化并返回字符串
|
// MarshalForString 序列化并返回字符串
|
||||||
@ -80,8 +81,9 @@ func (oj *ownJSON) MarshalForByte(input interface{}) []byte {
|
|||||||
//
|
//
|
||||||
// Date : 21:56 2023/7/22
|
// Date : 21:56 2023/7/22
|
||||||
func (oj *ownJSON) MarshalForString(input interface{}) string {
|
func (oj *ownJSON) MarshalForString(input interface{}) string {
|
||||||
byteData := oj.MarshalForByte(input)
|
buffer := bytes.NewBuffer([]byte{})
|
||||||
return string(byteData)
|
_ = json.NewEncoder(buffer).Encode(input)
|
||||||
|
return buffer.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConsoleOutput ...
|
// ConsoleOutput ...
|
||||||
|
Loading…
Reference in New Issue
Block a user