Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get json object error #62

Open
boneLau opened this issue Apr 22, 2017 · 0 comments
Open

get json object error #62

boneLau opened this issue Apr 22, 2017 · 0 comments

Comments

@boneLau
Copy link

boneLau commented Apr 22, 2017

first "Set" a json object into a new json object, and then the new json object "Get" the json out is error.because is the json address.

func (j *Json) Get(key string) *Json {
	m, err := j.Map()
	if err == nil {
		if val, ok := m[key]; ok {
			/////this may be used
			if reflect.TypeOf(val).Kind() == reflect.Ptr {
				if reflect.TypeOf(val).Elem().String() == "simplejson.Json"{
					return val.(*Json)
				}else{
					return &Json{nil}
				}
			}
			return &Json{val}
		}
	}
	return &Json{nil}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant