MCPcopy Create free account
hub / github.com/stretchr/objx / JSON

Method JSON

conversions.go:50–60  ·  view source on GitHub ↗

JSON converts the contained object to a JSON string representation

()

Source from the content-addressed store, hash-verified

48// JSON converts the contained object to a JSON string
49// representation
50func (m Map) JSON() (string, error) {
51 for k, v := range m {
52 m[k] = cleanUp(v)
53 }
54
55 result, err := json.Marshal(m)
56 if err != nil {
57 err = errors.New("objx: JSON encode failed with: " + err.Error())
58 }
59 return string(result), err
60}
61
62func cleanUpInterfaceArray(in []interface{}) []interface{} {
63 result := make([]interface{}, len(in))

Callers 5

MustJSONMethod · 0.95
Base64Method · 0.95
TestConversionJSONFunction · 0.95

Calls 2

cleanUpFunction · 0.85
ErrorMethod · 0.45

Tested by 3

TestConversionJSONFunction · 0.76