...
1
2
3
4 package json
5
6 import (
7 "encoding/json"
8 "io"
9 )
10
11 type Decoder = json.Decoder
12 type Delim = json.Delim
13 type Encoder = json.Encoder
14 type Marshaler = json.Marshaler
15 type Number = json.Number
16 type RawMessage = json.RawMessage
17 type Unmarshaler = json.Unmarshaler
18
19 func Engine() string {
20 return "encoding/json"
21 }
22
23
24
25 func NewDecoder(r io.Reader) *json.Decoder {
26 dec := json.NewDecoder(r)
27
28 muGlobalConfig.RLock()
29 if useNumber {
30 dec.UseNumber()
31 }
32 muGlobalConfig.RUnlock()
33
34 return dec
35 }
36
37 func NewEncoder(w io.Writer) *json.Encoder {
38 return json.NewEncoder(w)
39 }
40
41
42 func Marshal(v interface{}) ([]byte, error) {
43 return json.Marshal(v)
44 }
45
46
47 func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) {
48 return json.MarshalIndent(v, prefix, indent)
49 }
50
View as plain text