jsoniter_adapter.go 550 B

123456789101112131415161718
  1. // 设置jsoniter为默认库 // +build jsoniter // 仅当编译时带 -tags=jsoniter 参数时才生效
  2. package jsonutil
  3. import (
  4. "github.com/json-iterator/go"
  5. )
  6. var (
  7. adapter = jsoniter.ConfigCompatibleWithStandardLibrary
  8. Marshal = adapter.Marshal
  9. Unmarshal = adapter.Unmarshal
  10. MarshalToString = adapter.MarshalToString
  11. UnmarshalFromString = adapter.UnmarshalFromString
  12. MarshalIndent = adapter.MarshalIndent
  13. NewDecoder = adapter.NewDecoder
  14. NewEncoder = adapter.NewEncoder
  15. )