Lines Matching refs:json
5 // Package json implements encoding and decoding of JSON objects as defined in
6 // RFC 4627. The mapping between JSON objects and Go values is described
9 // See "JSON and Go" for an introduction to this package:
11 package json
28 // Marshal returns the JSON encoding of v.
33 // to produce JSON. The nil pointer exception is not strictly necessary
39 // Boolean values encode as JSON booleans.
41 // Floating point, integer, and Number values encode as JSON numbers.
43 // String values encode as JSON strings coerced to valid UTF-8,
46 // to keep some browsers from misinterpreting JSON output as HTML.
49 // Array and slice values encode as JSON arrays, except that
51 // encodes as the null JSON object.
53 // Struct values encode as JSON objects. Each exported struct field
60 // but can be specified in the struct field's tag value. The "json" key in
65 // Field int `json:"-"`
67 // // Field appears in JSON as key "myName".
68 // Field int `json:"myName"`
70 // // Field appears in JSON as key "myName" and
73 // Field int `json:"myName,omitempty"`
75 // // Field appears in JSON as key "Field" (the default), but
78 // Field int `json:",omitempty"`
80 // The "string" option signals that a field is stored as JSON inside a
81 // JSON-encoded string. It applies only to fields of string, floating point,
85 // Int64String int64 `json:",string"`
94 // An anonymous struct field with a name given in its JSON tag is treated as
99 // The Go visibility rules for struct fields are amended for JSON when
105 // 1) Of those fields, if any are JSON-tagged, only tagged fields are considered,
113 // a JSON tag of "-".
115 // Map values encode as JSON objects.
116 // The map's key type must be string; the map keys are used as JSON object
120 // A nil pointer encodes as the null JSON object.
123 // A nil interface value encodes as the null JSON object.
125 // Channel, complex, and function values cannot be encoded in JSON.
129 // JSON cannot represent cyclic data structures and Marshal does not
156 // HTMLEscape appends to dst the JSON-encoded src with <, >, &, U+2028 and U+2029
158 // so that the JSON will be safe to embed inside HTML <script> tags.
160 // escaping within <script> tags, so an alternative JSON encoding must
192 // can marshal themselves into valid JSON.
204 return "json: unsupported type: " + e.Type.String()
213 return "json: unsupported value: " + e.Str
227 return "json: invalid UTF-8 in string: " + strconv.Quote(e.S)
236 return "json: error calling MarshalJSON for type " + e.Type.String() + ": " + e.Err.Error()
241 // An encodeState encodes JSON into a bytes.Buffer.
416 // copy JSON into buffer, checking validity.
433 // copy JSON into buffer, checking validity.
813 // are rendered into JSON and served to some browsers.
834 // They are both technically valid characters in JSON strings,
836 // and can lead to security holes there. It is valid JSON to
838 // See http://timelessrepo.com/json-isnt-a-javascript-subset for discussion.
889 // are rendered into JSON and served to some browsers.
910 // They are both technically valid characters in JSON strings,
912 // and can lead to security holes there. It is valid JSON to
914 // See http://timelessrepo.com/json-isnt-a-javascript-subset for discussion.
954 // then breaking ties with "name came from json tag", then
994 // typeFields returns a list of fields that JSON should recognize for the given type.
1028 tag := sf.Tag.Get("json")
1095 // except that fields with JSON tags are promoted.
1131 // JSON tags. If there are multiple top-level fields, the boolean