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

Issue in Set when value is a *simple.Json #95

Open
wizdzz opened this issue Nov 12, 2023 · 0 comments
Open

Issue in Set when value is a *simple.Json #95

wizdzz opened this issue Nov 12, 2023 · 0 comments

Comments

@wizdzz
Copy link

wizdzz commented Nov 12, 2023

When call "Set" to a new JsonObj with the value is a *simple.Json, the new JsonObj will not able to get the value in the specific *simple.Json, have to cast the value with ".Interface()"

xx, _ := simplejson.NewJson([]byte(`{"name": "Alice"}`))
yy := simplejson.New()
yy.Set("Contact", xx)
yy1 := simplejson.New()
yy1.Set("Contact", xx.Interface())
zz := yy.Get("Contact")
zz1 := yy1.Get("Contact")
fmt.Println(xx.Get("name"))
fmt.Println(zz.Get("name"))
fmt.Println(zz1.Get("name"))

Got output:

&{Alice}
&{<nil>}
&{Alice}
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