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

if json path key hava . ,how to get the key value ? [ need help ] #352

Closed
Lucareful opened this issue Mar 8, 2024 · 2 comments
Closed

Comments

@Lucareful
Copy link

Problem

str := `{"code":200,"msg":"","data":{"www.test.com":["hello world"]}}`

I want to get ["hello world"], if i use gjson.Get(str, "data.www.test.com"), it dont work,beacuese . is path,how can i get result ["hello world"]

Greatful!

@volans-
Copy link

volans- commented Mar 8, 2024 via email

@Lucareful
Copy link
Author

You have to escape the special characters. See the https://github.com/tidwall/gjson/blob/master/SYNTAX.md#escape-character section of the documentation.

On Fri, Mar 8, 2024, 10:01 Lucareful @.> wrote: Problem str := {"code":200,"msg":"","data":{"[www.test.com":["hello](http://www.test.com":["hello) world"]}} I want to get ["hello world"], if i use gjson.Get(str, "data.www.test.com "), it dont work,beacuese . is path,how can i get result ["hello world"] Greatful! — Reply to this email directly, view it on GitHub <#352>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABURVOMDDDER35XR3I6F5OLYXF5AFAVCNFSM6AAAAABEMOSFH6VHI2DSMVQWIX3LMV43ASLTON2WKOZSGE3TKNJYHEYTMMQ . You are receiving this because you are subscribed to this thread.Message ID: @.>

thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants