// UnmarshalJSON implements the encoding/json Unmarshaler interface. It will
// decode a given []byte into s, so long as the provided []byte is a valid JSON
//string or a null.
//
// An empty string will result in a valid-but-empty String. The keyword 'null'
// will result in a null String. The string '"null"' is considered to be a
// string -- not a keyword -- and will result in a valid String.
//
// If the decode fails, the value of s will be unchanged.
UnmarshalJSON implements the encoding/json Unmarshaler interface. It will
decode a given []byte into s, so long as the provided []byte is a valid JSON
string or a null.

An empty string will result in a valid-but-empty String. The keyword 'null'
will result in a null String. The string '"null"' is considered to be a
string -- not a keyword -- and will result in a valid String.

If the decode fails, the value of s will be unchanged.
// UnmarshalJSON implements the encoding / json Unmarshaler interface . It will // decode a given [] byte into s so long as the provided [] byte is a valid JSON // string or a null . // // An empty string will result in a valid - but - empty String . The keyword ' null ' // will result in a null String . The string ' " null " ' is considered to be a // string -- not a keyword -- and will result in a valid String . // // If the decode fails the value of s will be unchanged .
func (s *String) UnmarshalJSON(data []byte) error {
	if s == nil {
		return fmt.Errorf("null.String: UnmarshalJSON called on nil pointer")
	}
	var j interface{}
	if err := json.Unmarshal(data, &j); err != nil {
		return err
	}
	switch val := j.(type) {
	case string:
		s.String = val
		s.Valid = true
		return nil
	case nil:
		s.String = ""
		s.Valid = false
		return nil
	default:
		return fmt.Errorf("null.String: cannot unmarshal JSON of type %T (%v)",
			val, data)
	}
}
func ( s * String ) UnmarshalJSON ( data [ ] byte ) error { if s == nil { return fmt . Errorf ( " " ) } var j interface { } if err := json . Unmarshal ( data , & j ) ; err != nil { return err } switch val := j . ( type ) { case string : s . String = val s . Valid = true return nil case nil : s . String = " " s . Valid = false return nil default : return fmt . Errorf ( " " , val , data ) } }
UnmarshalJSON implements the encoding/json Unmarshaler interface.
UnmarshalJSON implements the encoding / json Unmarshaler interface .