Open
Description
I'm trying to read JSON from a stream using the New().Reader()
method (I'm using the docker api). I want to read the same JSON value which will be continuously updated in a for loop. Using the following code my output is empty and my program will just hang in the loop forever.
resp, err := cli.ContainerStats(ctx, cont_id.String(), true)
if err != nil {
panic(err)
}
jq := gojsonq.New().Reader(resp.Body)
if jq.Error() != nil {
panic(jq.Errors())
}
for {
value := jq.Find("myKey")
fmt.Println(value)
}
For the sake of the example my JSON is just:
{
"myKey": "myVal"
}
Metadata
Metadata
Assignees
Labels
No labels