Closed hyde-zhang closed 2 years ago
The Result Array() function doesn't do what the comments says.
nonArrayData := "{\"jsonrpc\":\"2.0\",\"method\":\"subscription\",\"params\":{\"channel\":\"funny_channel\",\"data\":{\"name\":\"Jason\",\"company\":\"good_company\",\"number\":12345}}}" parsed := gjson.Parse(nonArrayData) for _, doc := range parsed.Get("params.data").Array() { log.Println(doc.Raw) // not called } arrayData := "{\"jsonrpc\":\"2.0\",\"method\":\"subscription\",\"params\":{\"channel\":\"funny_channel\",\"data\":[{\"name\":\"Jason\",\"company\":\"good_company\",\"number\":12345}]}}" parsed = gjson.Parse(arrayData) for _, doc := range parsed.Get("params.data").Array() { log.Println(doc.Raw) }
Think the issue is this i.e. it skips too much. Either update the function commends or please don't skip '{'
Thanks for reporting! I found the issue and fixed it in v1.9.4
The Result Array() function doesn't do what the comments says.
Think the issue is this i.e. it skips too much. Either update the function commends or please don't skip '{'