Filtering values with JSON PATH string


I need to filter incoming messages from Websocket by variable using the filter on actual values. This is working example of selecting element based on filter variable:

How to filter out messages based on value? I have done some research and the below line should work, but it isnt.
$.[?(@.my_attr == 5456)]
ultimately, I would create filter using variable:
$.[?(@.my_attr == $my_attr_filter)]

Thank you!

Hi can you give us an example of your output json? which plugin you are using? (JSON API or infinity ). If infinity I have some example about filtering here.

Sorry. it is very little information in the original query.