I want to get pretaxCost > 0
data but i met trouble like below :
my JMESPath
[?pretaxCost.to_number(@) > 0]
demo data :
[
{
"pretaxCost": "7.19999999999999962124684594298729134465020251809619367122650146484375E-8",
"instanceName": "demo202009210002"
},
{
"pretaxCost": "0",
"instanceName": "demo202009210002"
},
{
"pretaxCost": "0",
"instanceName": "demo20092701"
},
{
"pretaxCost": "0.2399999999999999911182158029987476766109466552734375",
"instanceName": "demo965546464"
},
{
"pretaxCost": "0.06278620880000000681331329133172403089702129364013671875",
"instanceName": "weihanacrdemo"
},
{
"pretaxCost": "2.16000000000000001872295179138061538282045148662291467189788818359375E-7",
"instanceName": "092d02d45a464c1291715701"
}
]
system show error message :
jmespath.min.js:2 Uncaught ParserError: Invalid token (Number): "0"
what I've tried to think :
I think pretaxCost is string type , so I have to cast type to number,so I use to_number
function, then using expression > 0
to get my expected result,but it's not work..
and i tried to only select pretaxCost to_number is work like below demo :
JSFiddle - Code Playground
I read the doc JMESPath Examples — JMESPath
and I try below expression and it's work
system have to use
JSFiddle - Code Playground