json-iterator/go

dx suggestion

jpillora opened this issue · 0 comments

  • make a json subdirectory
  • make a file with:
package json

import jsoniter "github.com/json-iterator/go"

var json = jsoniter.ConfigCompatibleWithStandardLibrary

func Marshal(v any) (b []byte, error) {
   return json.Marshal(v)
}

func Unmarshal(b []byte, v any) error {
   return json.Unmarshal(b, v)
}
  • change README standard library replace usage from
import jsoniter "github.com/json-iterator/go"

var json = jsoniter.ConfigCompatibleWithStandardLibrary
json.Unmarshal(input, &data)
  • to
import "github.com/json-iterator/go/json"

json.Unmarshal(input, &data)