summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
Diffstat (limited to 'compat')
-rw-r--r--compat/json/compat.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/compat/json/compat.go b/compat/json/compat.go
index fc693f8..f8b23e3 100644
--- a/compat/json/compat.go
+++ b/compat/json/compat.go
@@ -50,7 +50,7 @@ func convertEncodeError(err error) error {
func marshal(v any, formatter *lowmemjson.ReEncoder) ([]byte, error) {
var buf bytes.Buffer
formatter.Out = &buf
- if err := convertEncodeError(lowmemjson.Encode(formatter, v)); err != nil {
+ if err := convertEncodeError(lowmemjson.NewEncoder(formatter).Encode(v)); err != nil {
return nil, err
}
return buf.Bytes(), nil
@@ -213,7 +213,7 @@ func convertDecodeError(err error) error {
}
func Unmarshal(data []byte, ptr any) error {
- return convertDecodeError(lowmemjson.DecodeThenEOF(bytes.NewReader(data), ptr))
+ return convertDecodeError(lowmemjson.NewDecoder(bytes.NewReader(data)).DecodeThenEOF(ptr))
}
type Decoder struct {