Home | History | Annotate | Download | only in json

Lines Matching defs:String

41 // and the input is a JSON quoted string, Unmarshal calls that value's
42 // UnmarshalText method with the unquoted form of the string.
54 // string, for JSON strings
56 // map[string]interface{}, for JSON objects
75 // either be a string, an integer, or implement encoding.TextUnmarshaler.
122 Value string // description of JSON value - "bool", "array", "number -5"
125 Struct string // name of the struct type containing the field
126 Field string // name of the field holding the Go value
129 func (e *UnmarshalTypeError) Error() string {
131 return "json: cannot unmarshal " + e.Value + " into Go struct field " + e.Struct + "." + e.Field + " of type " + e.Type.String()
133 return "json: cannot unmarshal " + e.Value + " into Go value of type " + e.Type.String()
140 Key string
145 func (e *UnmarshalFieldError) Error() string {
146 return "json: cannot unmarshal object key " + strconv.Quote(e.Key) + " into unexported field " + e.Field.Name + " of type " + e.Type.String()
155 func (e *InvalidUnmarshalError) Error() string {
161 return "json: Unmarshal(non-pointer " + e.Type.String() + ")"
163 return "json: Unmarshal(nil " + e.Type.String() + ")"
189 type Number string
191 // String returns the literal text of the number.
192 func (n Number) String() string { return string(n) }
196 return strconv.ParseFloat(string(n), 64)
201 return strconv.ParseInt(string(n), 10, 64)
205 func isValidNumber(s string) bool {
271 Struct string
272 Field string
372 // Feed in an empty string - the shortest, simplest value -
412 // quoted string literal or literal null into an interface value.
413 // If it finds anything other than a quoted string literal or null,
428 case nil, string:
620 // map[T1]T2 where T1 is string, an integer type,
624 // Map key must either have string kind, have an integer kind,
628 case reflect.String,
654 // Read opening " of string key or closing }.
675 destring := false // whether the value is wrapped in a string to be decoded first
727 case string:
730 d.saveError(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal unquoted value into %v", subv.Type()))
742 case kt.Kind() == reflect.String:
751 s := string(key)
759 s := string(key)
804 func (d *decodeState) convertNumber(s string) (interface{}, error) {
820 // string from the ",string" struct tag option. this is used only to
825 //Empty string given
826 d.saveError(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type()))
841 d.saveError(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type()))
843 var val string
859 d.error(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type()))
876 // but if this was a quoted string input, it could be anything.
877 if fromQuoted && string(item) != "null" {
878 d.saveError(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type()))
884 // otherwise, ignore null for primitives/string
889 // but if this was a quoted string input, it could be anything.
890 if fromQuoted && string(item) != "true" && string(item) != "false" {
891 d.saveError(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type()))
897 d.saveError(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type()))
911 case '"': // string
915 d.error(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type()))
922 d.saveError(&UnmarshalTypeError{Value: "string", Type: v.Type(), Offset: int64(d.off)})
925 d.saveError(&UnmarshalTypeError{Value: "string", Type: v.Type(), Offset: int64(d.off)})
935 case reflect.String:
936 v.SetString(string(s))
939 v.Set(reflect.ValueOf(string(s)))
941 d.saveError(&UnmarshalTypeError{Value: "string", Type: v.Type(), Offset: int64(d.off)})
948 d.error(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type()))
953 s := string(item)
956 if v.Kind() == reflect.String && v.Type() == numberType {
964 d.error(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type()))
1054 // objectInterface is like object but returns map[string]interface{}.
1055 func (d *decodeState) objectInterface() map[string]interface{} {
1056 m := make(map[string]interface{})
1058 // Read opening " of string key or closing }.
1068 // Read string key.
1118 case '"': // string
1129 n, err := d.convertNumber(string(item))
1143 r, err := strconv.ParseUint(string(s[2:6]), 16, 64)
1150 // unquote converts a quoted JSON string literal s into an actual string t.
1152 func unquote(s []byte) (t string, ok bool) {
1154 t = string(s)