MCPcopy Create free account
hub / github.com/LanceLRQ/deer-executor / ObjectToJSONStringFormatted

Function ObjectToJSONStringFormatted

common/utils/json.go:10–21  ·  view source on GitHub ↗

ObjectToJSONStringFormatted 将对象转换成JSON字符串并格式化

(conf interface{})

Source from the content-addressed store, hash-verified

8
9// ObjectToJSONStringFormatted 将对象转换成JSON字符串并格式化
10func ObjectToJSONStringFormatted(conf interface{}) string {
11 b, err := json.Marshal(conf)
12 if err != nil {
13 return fmt.Sprintf("%+v", conf)
14 }
15 var out bytes.Buffer
16 err = json.Indent(&out, b, "", " ")
17 if err != nil {
18 return fmt.Sprintf("%+v", conf)
19 }
20 return out.String()
21}
22
23// ObjectToJSONByte 将对象转换成JSON字节数组
24func ObjectToJSONByte(obj interface{}) []byte {

Callers 10

ToJSONMethod · 0.92
ReadProblemInfoFunction · 0.92
runJudgeBenchmarkFunction · 0.92
MakeProblemConfigFileFunction · 0.92
InitProblemWorkDirFunction · 0.92
MakeCompileConfigFileFunction · 0.92
MakeJITMemoryConfigFileFunction · 0.92
runJudgeBenchmarkFunction · 0.92
analysisResultFunction · 0.92
SaveConfigurationMethod · 0.92

Calls 1

StringMethod · 0.65

Tested by 1

runJudgeBenchmarkFunction · 0.74