(experimental) upgraded to encoding/json/v2

This commit is contained in:
Gani Georgiev committed 2026-08-18 18:16:22 +03:00
1 parent 4d4275c9aa
commit 97dd775455
125 files changed
+433 -364

No files matched your search

+5 -5
View File
@@ -3,7 +3,7 @@ package jsvm
import (
"bytes"
"context"
"encoding/json"
"encoding/json/v2"
"errors"
"io"
"io/fs"
@@ -352,7 +352,7 @@ func BindCore(vm *goja.Runtime) {
}
// as a last attempt try to json encode the value
rawBytes, _ := json.Marshal(raw)
rawBytes, _ := json.Marshal(raw, json.Deterministic(true))
return rawBytes, nil
}
@@ -381,7 +381,7 @@ func BindCore(vm *goja.Runtime) {
}
// as a last attempt try to json encode the value
rawBytes, _ := json.Marshal(raw)
rawBytes, _ := json.Marshal(raw, json.Deterministic(true))
return string(rawBytes), nil
}
@@ -1217,13 +1217,13 @@ func newDynamicModel(shape map[string]any) any {
case reflect.Map:
raw, _ := json.Marshal(v)
newV := types.JSONMap[any]{}
newV.Scan(raw)
_ = newV.Scan(raw)
v = newV
vt = reflect.TypeOf(v)
case reflect.Slice, reflect.Array:
raw, _ := json.Marshal(v)
newV := types.JSONArray[any]{}
newV.Scan(raw)
_ = newV.Scan(raw)
v = newV
vt = reflect.TypeOf(newV)
case reflect.Pointer: