MCPcopy
hub / github.com/pquerna/ffjson / Decode

Method Decode

ffjson/decoder.go:41–57  ·  view source on GitHub ↗

Decode the data in the supplied data slice.

(data []byte, v interface{})

Source from the content-addressed store, hash-verified

39
40// Decode the data in the supplied data slice.
41func (d *Decoder) Decode(data []byte, v interface{}) error {
42 f, ok := v.(unmarshalFaster)
43 if ok {
44 if d.fs == nil {
45 d.fs = fflib.NewFFLexer(data)
46 } else {
47 d.fs.Reset(data)
48 }
49 return f.UnmarshalJSONFFLexer(d.fs, fflib.FFParse_map_start)
50 }
51
52 um, ok := v.(json.Unmarshaler)
53 if ok {
54 return um.UnmarshalJSON(data)
55 }
56 return json.Unmarshal(data, v)
57}
58
59// Decode the data from the supplied reader.
60// You should expect that data is read into memory before it is decoded.

Callers 1

DecodeReaderMethod · 0.95

Calls 3

ResetMethod · 0.65
UnmarshalJSONFFLexerMethod · 0.65
UnmarshalJSONMethod · 0.45

Tested by

no test coverage detected