gitee.com/lh-her-team/common@v1.5.1/json/json.go (about)

     1  package json
     2  
     3  import (
     4  	"io"
     5  
     6  	jsoniter "github.com/json-iterator/go"
     7  )
     8  
     9  func Marshal(v interface{}) ([]byte, error) {
    10  	return jsoniter.Marshal(v)
    11  }
    12  
    13  func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) {
    14  	return jsoniter.MarshalIndent(v, prefix, indent)
    15  }
    16  
    17  func Unmarshal(data []byte, v interface{}) error {
    18  	return jsoniter.Unmarshal(data, v)
    19  }
    20  
    21  func NewDecoder(r io.Reader) *jsoniter.Decoder {
    22  	return jsoniter.NewDecoder(r)
    23  }