You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I run gjson.Get(testJSON, "friends") I'll get an array back of the friends. Ok all good.
If I run gjson.Get(testJSON, "friends.#") I will get 4 back. Meaning that if I use .# on the end of a path that is an array, I will get the count back.
Problem Behavior
If I run gjson.Get(testJSON, "friends.#(last==\"Murphy\")#") I get an array back of size two and only with friends with the last name Murphy. All good, still works as expected.
HOWEVER, using the same .# at the end of a path that leads to an array, I would expect to get back the count of that array, but I do not. So if I run gjson.Get(testJSON, "friends.#(last==\"Murphy\")#.#") I actually get back an empty array [].
I would expect to get the count of that array which should be 2.
The text was updated successfully, but these errors were encountered:
Using a dot after a # is like doing a Get operation on each friend in the array, but using a pipe is like will doing one Get operation on the resulting array.
Using this JSON:
Normal Behavior
If I run
gjson.Get(testJSON, "friends")
I'll get an array back of the friends. Ok all good.If I run
gjson.Get(testJSON, "friends.#")
I will get4
back. Meaning that if I use.#
on the end of a path that is an array, I will get the count back.Problem Behavior
If I run
gjson.Get(testJSON, "friends.#(last==\"Murphy\")#")
I get an array back of size two and only with friends with the last name Murphy. All good, still works as expected.HOWEVER, using the same
.#
at the end of a path that leads to an array, I would expect to get back the count of that array, but I do not. So if I rungjson.Get(testJSON, "friends.#(last==\"Murphy\")#.#")
I actually get back an empty array[]
.I would expect to get the count of that array which should be
2
.The text was updated successfully, but these errors were encountered: