MCPcopy
hub / github.com/gogf/gf / Marshal

Function Marshal

internal/json/json.go:27–33  ·  view source on GitHub ↗

Marshal adapts to json/encoding Marshal API. Marshal returns the JSON encoding of v, adapts to json/encoding Marshal API Refer to https://godoc.org/encoding/json#Marshal for more information.

(v any)

Source from the content-addressed store, hash-verified

25// Marshal returns the JSON encoding of v, adapts to json/encoding Marshal API
26// Refer to https://godoc.org/encoding/json#Marshal for more information.
27func Marshal(v any) (marshaledBytes []byte, err error) {
28 marshaledBytes, err = json.Marshal(v)
29 if err != nil {
30 err = gerror.Wrap(err, `json.Marshal failed`)
31 }
32 return
33}
34
35// MarshalIndent same as json.MarshalIndent.
36func MarshalIndent(v any, prefix, indent string) (marshaledBytes []byte, err error) {

Callers 15

Test_String_JSONFunction · 0.92
Test_Interface_JSONFunction · 0.92
MarshalJSONMethod · 0.92
Test_Float64_JSONFunction · 0.92
Test_Float32_JSONFunction · 0.92
Test_Int_JSONFunction · 0.92
Test_Uint_JSONFunction · 0.92
Test_Uint32_JSONFunction · 0.92
Test_Int32_JSONFunction · 0.92
Test_Int64_JSONFunction · 0.92
Test_Bytes_JSONFunction · 0.92
Test_Bool_JSONFunction · 0.92

Calls 2

WrapFunction · 0.92
MarshalMethod · 0.80

Tested by 15

Test_String_JSONFunction · 0.74
Test_Interface_JSONFunction · 0.74
Test_Float64_JSONFunction · 0.74
Test_Float32_JSONFunction · 0.74
Test_Int_JSONFunction · 0.74
Test_Uint_JSONFunction · 0.74
Test_Uint32_JSONFunction · 0.74
Test_Int32_JSONFunction · 0.74
Test_Int64_JSONFunction · 0.74
Test_Bytes_JSONFunction · 0.74
Test_Bool_JSONFunction · 0.74
Benchmark_Bool_JsonFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…