MarshalDeterministicIndent 确定性地序列化为格式化的 JSON
(v any, prefix, indent string)
| 26 | |
| 27 | // MarshalDeterministicIndent 确定性地序列化为格式化的 JSON |
| 28 | func MarshalDeterministicIndent(v any, prefix, indent string) ([]byte, error) { |
| 29 | normalized := normalizeValue(reflect.ValueOf(v)) |
| 30 | return json.MarshalIndent(normalized, prefix, indent) |
| 31 | } |
| 32 | |
| 33 | // MarshalDeterministicToBuffer 确定性地序列化到 buffer(减少内存分配) |
| 34 | func MarshalDeterministicToBuffer(v any, buf *bytes.Buffer) error { |