MCPcopy Create free account
hub / github.com/francoispqt/gojay / encodeObject

Method encodeObject

encode_object.go:46–58  ·  view source on GitHub ↗
(v MarshalerJSONObject)

Source from the content-addressed store, hash-verified

44}
45
46func (enc *Encoder) encodeObject(v MarshalerJSONObject) ([]byte, error) {
47 enc.grow(512)
48 enc.writeByte('{')
49 if !v.IsNil() {
50 v.MarshalJSONObject(enc)
51 }
52 if enc.hasKeys {
53 enc.hasKeys = false
54 enc.keys = nil
55 }
56 enc.writeByte('}')
57 return enc.buf, enc.err
58}
59
60// AddObject adds an object to be encoded, must be used inside a slice or array encoding (does not encode a key)
61// value must implement MarshalerJSONObject

Callers 4

EncodeObjectMethod · 0.95
EncodeObjectKeysMethod · 0.95
MarshalJSONObjectFunction · 0.80
marshalFunction · 0.80

Calls 4

growMethod · 0.95
writeByteMethod · 0.95
IsNilMethod · 0.65
MarshalJSONObjectMethod · 0.65

Tested by

no test coverage detected