MCPcopy
hub / github.com/pocketbase/pocketbase / MarshalJSON

Method MarshalJSON

tools/types/json_raw.go:27–33  ·  view source on GitHub ↗

MarshalJSON implements the [json.Marshaler] interface.

()

Source from the content-addressed store, hash-verified

25
26// MarshalJSON implements the [json.Marshaler] interface.
27func (j JSONRaw) MarshalJSON() ([]byte, error) {
28 if len(j) == 0 {
29 return []byte("null"), nil
30 }
31
32 return j, nil
33}
34
35// UnmarshalJSON implements the [json.Unmarshaler] interface.
36func (j *JSONRaw) UnmarshalJSON(b []byte) error {

Callers 9

StringMethod · 0.95
TestJSONRawScanFunction · 0.95
TestJSONArrayMarshalJSONFunction · 0.45
TestJSONArrayScanFunction · 0.45
TestJSONMapMarshalJSONFunction · 0.45
TestJSONArrayMapScanFunction · 0.45
TestParseJSONRawFunction · 0.45
TestJSONRawMarshalJSONFunction · 0.45
TestDateTimeMarshalJSONFunction · 0.45

Calls

no outgoing calls

Tested by 8

TestJSONRawScanFunction · 0.76
TestJSONArrayMarshalJSONFunction · 0.36
TestJSONArrayScanFunction · 0.36
TestJSONMapMarshalJSONFunction · 0.36
TestJSONArrayMapScanFunction · 0.36
TestParseJSONRawFunction · 0.36
TestJSONRawMarshalJSONFunction · 0.36
TestDateTimeMarshalJSONFunction · 0.36