// Gets the value at key path and attempts to typecast the value into a string.
// Returns error if the value is not a json string.
// Example:
//		string, err := GetString("address", "street")
189364
func (v *Object) GetString(keys ...string) (string, error) {
	child, err := v.getPath(keys)

	if err != nil {
		return "", err
	} else {
		return child.String()
	}
}
1255319
func GetJSONPathValue(obj interface{}, path string, allowMissingKeys bool) (interface{}, error) {
	j := jsonpath.New("GetJSONPathValue")
	// If the key is missing, return an empty string without errors
	j.AllowMissingKeys(allowMissingKeys)
	err := j.Parse(path)
	if err != nil {
		return "", errors.Wrapf(err, "JsonPath parse %s error", path)
	}
	values, err := j.FindResults(obj)
	if err != nil {
		return "", errors.Wrap(err, "JsonPath execute error")
	}
	if len(values) == 0 {
		return nil, nil
	}
	if len(values) > 1 {
		return nil, errors.Errorf("single result expected, got %d", len(values))
	}
	if values[0] == nil || len(values[0]) == 0 || values[0][0].IsNil() {
		return nil, nil
	}
	return values[0][0].Interface(), nil
}
607872
func getValue(m map[string]interface{}, keys []string) string {
	node := m[keys[0]]

	for i := 1; i < len(keys); i++ {
		key := keys[i]

		sliceNode, ok := node.([]interface{})
		if ok {
			intKey, err := strconv.Atoi(key)
			if err != nil {
				panic(fmt.Sprintf(
					"Cannot access nested slice element with non-integer key: %s",
					key))
			}
			node = sliceNode[intKey]
			continue
		}

		mapNode, ok := node.(map[string]interface{})
		if ok {
			node = mapNode[key]
			continue
		}

		panic(fmt.Sprintf(
			"Cannot descend into non-map non-slice object with key: %s", key))
	}

	if node == nil {
		return ""
	}

	return fmt.Sprintf("%v", node)
}
189720
func (s *Session) GetString(ctx context.Context, key string) string {
	val := s.Get(ctx, key)
	str, ok := val.(string)
	if !ok {
		return ""
	}
	return str
}
311090
func (v Values) GetStr(key interface{}) interface{} {
	if v == nil { return "" }
	
	val := v.Get(key)
	if val == nil { return "" }

	str, ok := val.(string)
	if !ok { return "" }
	return str
}
863405
func (j *Json) GetPath(branch ...string) *Json {
	jin := j
	for _, p := range branch {
		jin = jin.Get(p)
	}
	return jin
}
196531
func (s Slice) GetString() (string, error) {
	bytes, err := s.GetStringUTF8()
	if err != nil {
		return "", WithStack(err)
	}
	return string(bytes), nil
}
664611
func getKey(s, key string) string {
	i := strings.Index(s, key)
	if i == -1 {
		return ""
	}
	if i+len(key)+1 >= len(s) || s[i+len(key)] != '=' {
		return ""
	}
	j := strings.Index(s, ",")
	if j == -1 {
		j = len(s)
	}
	return s[i+len(key)+1 : j]
}
945857
func GetJSONPathString(obj interface{}, path string) (string, error) {
	j := jsonpath.New("GetJSONPathString")
	// If the key is missing, return an empty string without errors
	j.AllowMissingKeys(true)
	err := j.Parse(path)
	if err != nil {
		return "", errors.Wrapf(err, "JsonPath parse %s error", path)
	}
	var buf bytes.Buffer
	err = j.Execute(&buf, obj)
	if err != nil {
		return "", errors.Wrap(err, "JsonPath execute error")
	}
	return buf.String(), nil
}
377536
func GetKeyField(keyString string, v reflect.Value) reflect.Value {
	return v.Elem().FieldByName(keyString)
}
246062
func GetString(r *http.Request, name string, value string) string {
	if v := r.FormValue(name); v != "" {
		return v
	}
	return value
}
1205245
func (meta Metadata) GetValueString(key string) string {
	return string(meta.GetValue(key))
}
641345
func Get(key string) ([]byte, error) {
	v, err := Client().Get(key)
	Trace("Get", err, logrus.Fields{fieldKey: key, fieldValue: string(v)})
	return v, err
}
565953
func (args Args) Get(key string) []string {
	values := args.fields[key]
	if values == nil {
		return make([]string, 0)
	}
	slice := make([]string, 0, len(values))
	for key := range values {
		slice = append(slice, key)
	}
	return slice
}
652507
func getBytes(json []byte, path string) Result {
	var result Result
	if json != nil {
		// unsafe cast to string
		result = Get(*(*string)(unsafe.Pointer(&json)), path)
		// safely get the string headers
		rawhi := *(*reflect.StringHeader)(unsafe.Pointer(&result.Raw))
		strhi := *(*reflect.StringHeader)(unsafe.Pointer(&result.Str))
		// create byte slice headers
		rawh := reflect.SliceHeader{Data: rawhi.Data, Len: rawhi.Len}
		strh := reflect.SliceHeader{Data: strhi.Data, Len: strhi.Len}
		if strh.Data == 0 {
			// str is nil
			if rawh.Data == 0 {
				// raw is nil
				result.Raw = ""
			} else {
				// raw has data, safely copy the slice header to a string
				result.Raw = string(*(*[]byte)(unsafe.Pointer(&rawh)))
			}
			result.Str = ""
		} else if rawh.Data == 0 {
			// raw is nil
			result.Raw = ""
			// str has data, safely copy the slice header to a string
			result.Str = string(*(*[]byte)(unsafe.Pointer(&strh)))
		} else if strh.Data >= rawh.Data &&
			int(strh.Data)+strh.Len <= int(rawh.Data)+rawh.Len {
			// Str is a substring of Raw.
			start := int(strh.Data - rawh.Data)
			// safely copy the raw slice header
			result.Raw = string(*(*[]byte)(unsafe.Pointer(&rawh)))
			// substring the raw
			result.Str = result.Raw[start : start+strh.Len]
		} else {
			// safely copy both the raw and str slice headers to strings
			result.Raw = string(*(*[]byte)(unsafe.Pointer(&rawh)))
			result.Str = string(*(*[]byte)(unsafe.Pointer(&strh)))
		}
	}
	return result
}
423062
func getStringValue(b []rune) (int, error) {
	if b[0] != '"' {
		return 0, NewParseError("strings must start with '\"'")
	}

	endQuote := false
	i := 1

	for ; i < len(b) && !endQuote; i++ {
		if escaped := isEscaped(b[:i], b[i]); b[i] == '"' && !escaped {
			endQuote = true
			break
		} else if escaped {
			/*c, err := getEscapedByte(b[i])
			if err != nil {
				return 0, err
			}

			b[i-1] = c
			b = append(b[:i], b[i+1:]...)
			i--*/

			continue
		}
	}

	if !endQuote {
		return 0, NewParseError("missing '\"' in string value")
	}

	return i + 1, nil
}
1238764
func (kv *KeyValBytes) GetValue(message proto.Message) error {
	return json.Unmarshal(kv.value, message)
}