JSON API in that JSONPath to query data using $.[?(@.Name==“variable”)]

I use JSON API in that JSONPath to query data using $.[?(@.Name==“variable”)] but I still got no data

Sample data below,

{
	"Assign_status": 0,
	"Car_Model": "Lexus ES",
	"Vehicle_Type": "Sedan"
},
{
	"Assign_status": 1,
	"Car_Model": "Dodge Challenger",
	"Vehicle_Type": "Muscle Car"
},
{
	"Assign_status": 1,
	"Car_Model": "Toyota Corolla",
	"Vehicle_Type": "Sedan",
},
{
	"Assign_status": 0,
	"Car_Model": "Ford Mustang",
	"Vehicle_Type": "Coupe",
}

in this case,
I create a panel in dashboard and query the data by using JSONPath:
$.[?(@.Assign_status == ‘0’)]
$.[?(@.Assign_status == ‘1’)] , but it shows Eval [?(expr)] prevented in JSONPath expression.

find assign is 1 and unassign is 0 and both should count

might be better using infinity plugin and use uql

https://grafana.github.io/grafana-infinity-datasource/docs/filters

car dealer

1 Like

hi,yosiasz

I need to find only “Assign_status” column and I want to count how many zeros and ones are there in a single panel. I should view both counted zeros and ones
sample data ,
[
{
“Assign_status”: 0,
“Car_Model”: “Lexus ES”,
“Location_ID”: 5,
“Vehicle_ID”: 10,
“Vehicle_Type”: “Sedan”,
“Year_Model”: 2022
},
{
“Assign_status”: 1,
“Car_Model”: “Dodge Challenger”,
“Location_ID”: 4,
“Vehicle_ID”: 9,
“Vehicle_Type”: “Muscle Car”,
“Year_Model”: 2020
},
{
“Assign_status”: 1,
“Car_Model”: “Toyota Corolla”,
“Location_ID”: 2,
“Vehicle_ID”: 8,
“Vehicle_Type”: “Sedan”,
“Year_Model”: 2018
},
{
“Assign_status”: 0,
“Car_Model”: “Ford Mustang”,
“Location_ID”: 3,
“Vehicle_ID”: 7,
“Vehicle_Type”: “Coupe”,
“Year_Model”: 2023
},
{
“Assign_status”: 1,
“Car_Model”: “Chevrolet Malibu”,
“Vehicle_Type”: “Sedan”,
“Year_Model”: 2017
}
]

cool. here is the docu for uql try it out tp find filter by status and how to do count

https://grafana.github.io/grafana-infinity-datasource/docs/uql

then when you havw tried something and are stuck we can help you.