Open Kur-Ich opened 3 years ago
Hi, I'm getting as response an array of objects. Is there a way to pretty the whole array or json object? I can't give in a path because I need the whole array directly underneath the object.
Resp: [{"sport":"Greyhound Racing","plan":"Basic Plan","forDate":"2020-01-01T00:00:00","purchaseItemId":65721},{"sport":"Greyhound Racing","plan":"Basic Plan","forDate":"2020-02-01T00:00:00","purchaseItemId":65721},...]
I tried: js := gjson.GetBytes(bs, "|@pretty")
Thanks
Solved it like this:
jss := gjson.ParseBytes(resp) for _, js := range jss.Array() { println(js.String()) }
Hi, I'm getting as response an array of objects. Is there a way to pretty the whole array or json object? I can't give in a path because I need the whole array directly underneath the object.
Resp: [{"sport":"Greyhound Racing","plan":"Basic Plan","forDate":"2020-01-01T00:00:00","purchaseItemId":65721},{"sport":"Greyhound Racing","plan":"Basic Plan","forDate":"2020-02-01T00:00:00","purchaseItemId":65721},...]
I tried: js := gjson.GetBytes(bs, "|@pretty")
Thanks