Closed sharadregoti closed 1 year ago
With the below sample data set
{ "name": {"first": "Tom", "last": "Anderson"}, "age":37, "children": ["Sara","Alex","Jack"], "fav.movie": "Deer Hunter", "friends": [ {"first": "Dale", "last": "Murphy", "age": 44, "nets": ["ig", "fb", "tw"]}, {"first": "Roger", "last": "Craig", "age": 68, "nets": ["fb", "tw"]}, {"first": "Jane", "last": "Murphy", "age": 47, "nets": ["ig", "tw"]} ] }
If execute the query "children.#", It gives me the length of an array.
"children.#"
Now, If run this query friends.#(last=="Murphy")# It gives me the filtered result to access that is >> ["Dale","Jane"]. But not the length.
friends.#(last=="Murphy")#
>> ["Dale","Jane"]
How can i get the length of last query result? friends.#(last=="Murphy")# >> 2
friends.#(last=="Murphy")# >> 2
I tried this friends.#(last=="Murphy").# But this gave me empty result
friends.#(last=="Murphy").#
@sharadregoti you can get it with the pipe | separator: friends.#(last=="Murphy")#|# >> 2 See also the Dot vs Pipe section of the syntax page for more details about it.
|
friends.#(last=="Murphy")#|#
2
Great it worked!!
With the below sample data set
If execute the query
"children.#"
, It gives me the length of an array.Now, If run this query
friends.#(last=="Murphy")#
It gives me the filtered result to access that is>> ["Dale","Jane"]
. But not the length.How can i get the length of last query result?
friends.#(last=="Murphy")# >> 2
I tried this
friends.#(last=="Murphy").#
But this gave me empty result