rpc: use go-json

This commit is contained in:
MariusVanDerWijden 2025-06-10 22:41:13 +02:00
parent 5b79f4d2da
commit ec880b1737

View file

@ -27,6 +27,8 @@ import (
"strings"
"sync"
"time"
gojson "github.com/goccy/go-json"
)
const (
@ -308,7 +310,7 @@ func isBatch(raw json.RawMessage) bool {
// given types. It returns the parsed values or an error when the args could not be
// parsed. Missing optional arguments are returned as reflect.Zero values.
func parsePositionalArguments(rawArgs json.RawMessage, types []reflect.Type) ([]reflect.Value, error) {
dec := json.NewDecoder(bytes.NewReader(rawArgs))
dec := gojson.NewDecoder(bytes.NewReader(rawArgs))
var args []reflect.Value
tok, err := dec.Token()
switch {
@ -335,7 +337,7 @@ func parsePositionalArguments(rawArgs json.RawMessage, types []reflect.Type) ([]
return args, nil
}
func parseArgumentArray(dec *json.Decoder, types []reflect.Type) ([]reflect.Value, error) {
func parseArgumentArray(dec *gojson.Decoder, types []reflect.Type) ([]reflect.Value, error) {
args := make([]reflect.Value, 0, len(types))
for i := 0; dec.More(); i++ {
if i >= len(types) {