summaryrefslogtreecommitdiff
path: root/encode.go
diff options
context:
space:
mode:
Diffstat (limited to 'encode.go')
-rw-r--r--encode.go9
1 files changed, 1 insertions, 8 deletions
diff --git a/encode.go b/encode.go
index 492b40f..b6541cd 100644
--- a/encode.go
+++ b/encode.go
@@ -8,7 +8,6 @@ import (
"bytes"
"encoding"
"encoding/base64"
- "encoding/json"
"fmt"
"io"
"reflect"
@@ -96,12 +95,6 @@ func discardInt(_ int, err error) error {
return err
}
-var (
- encodableType = reflect.TypeOf((*Encodable)(nil)).Elem()
- jsonMarshalerType = reflect.TypeOf((*json.Marshaler)(nil)).Elem()
- textMarshalerType = reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem()
-)
-
const startDetectingCyclesAfter = 1000
func encode(w *ReEncoder, val reflect.Value, escaper BackslashEscaper, quote bool, cycleDepth uint, cycleSeen map[any]struct{}) error {
@@ -145,7 +138,7 @@ func encode(w *ReEncoder, val reflect.Value, escaper BackslashEscaper, quote boo
if val.Kind() == reflect.Pointer && val.IsNil() {
return discardInt(w.WriteString("null"))
}
- obj, ok := val.Interface().(json.Marshaler)
+ obj, ok := val.Interface().(jsonMarshaler)
if !ok {
return discardInt(w.WriteString("null"))
}