Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dx suggestion #683

Open
jpillora opened this issue Aug 11, 2023 · 0 comments
Open

dx suggestion #683

jpillora opened this issue Aug 11, 2023 · 0 comments

Comments

@jpillora
Copy link

jpillora commented Aug 11, 2023

  • 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant