Discussion:
Jsonpath loses its last zero
贾国动
2018-12-06 09:17:51 UTC
Permalink
I'm trying to get the data using jsonpath from the http response, but it doesn't seem to work very well, does anybody know why.

my JMeter: Apache JMeter Version 4.0 r1823414





Thanks a lot~
贾国动
2018-12-06 09:36:00 UTC
Permalink
Sorry, I found the attached screenshot could not be displayed.



---response

{"moduleId":25,"dimensionInfoList":[{"dimensionId":"vip","dimensionName":"䌚员价","adjustPrice":0.00},{"dimensionId":"net_sale","dimensionName":"眑售价","adjustPrice":6.55},{"dimensionId":"student","dimensionName":"孊生价","adjustPrice":-1.00},{"dimensionId":"adult","dimensionName":"成人价","adjustPrice":5.50}]}



---jsonpath

$.dimensionInfoList..adjustPrice



--result

Result[0]=0.0

Result[1]=6.55

Result[2]=-1.0

Result[3]=5.5



I don't know why the“0” at the end is missing, then my assertion will failed.







发件人: 莟囜劚 <***@sireninformation.com>
答倍: JMeter Users List <***@jmeter.apache.org>
日期: 2018幎12月6日 星期四 17:18
收件人: <***@jmeter.apache.org>
䞻题: Jsonpath loses its last zero



I'm trying to get the data using jsonpath from the http response, but it doesn't seem to work very well, does anybody know why.

my JMeter: Apache JMeter Version 4.0 r1823414





Thanks a lot~





--------------------------------------------------------------------- To unsubscribe, e-mail: user-***@jmeter.apache.org For additional commands, e-mail: user-***@jmeter.apache.org
Felix Schumacher
2018-12-06 10:58:41 UTC
Permalink
Post by 贾国动
Sorry, I found the attached screenshot could not be displayed.
---response
{"moduleId":25,"dimensionInfoList":[{"dimensionId":"vip","dimensionName":"会员价","adjustPrice":0.00},{"dimensionId":"net_sale","dimensionName":"网售价","adjustPrice":6.55},{"dimensionId":"student","dimensionName":"学生价","adjustPrice":-1.00},{"dimensionId":"adult","dimensionName":"成人价","adjustPrice":5.50}]}
---jsonpath
$.dimensionInfoList..adjustPrice
--result
Result[0]=0.0
Result[1]=6.55
Result[2]=-1.0
Result[3]=5.5
I don't know why the“0” at the end is missing, then my assertion will
failed.
The values will be considered to be floats and represented as strings. Zeroes at the end of the fraction will be removed by that process.

You would either have to re-format the number (string really) or use the shortened string for your assertion.

Regards,
Felix
Post by 贾国动
日期: 2018年12月6日 星期四 17:18
主题: Jsonpath loses its last zero
I'm trying to get the data using jsonpath from the http response, but
it doesn't seem to work very well, does anybody know why.
my JMeter: Apache JMeter Version 4.0 r1823414
Thanks a lot~
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@jmeter.apache.org
For additional commands, e-mail: user-***@jmeter.apache.org

Loading...