Jsonpath loses its last zero

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

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: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Jsonpath loses its last zero

贾国动
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.

 

 

 

发件人: 贾国动 <[hidden email]>
答复: JMeter Users List <[hidden email]>
日期: 2018年12月6日 星期四 17:18
收件人: <[hidden email]>
主题: 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: [hidden email] For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Jsonpath loses its last zero

Felix Schumacher


Am 6. Dezember 2018 10:36:00 MEZ schrieb "贾国动" <[hidden email]>:

>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

>
>
>
>
>
>
>
>发件人: 贾国动 <[hidden email]>
>答复: JMeter Users List <[hidden email]>
>日期: 2018年12月6日 星期四 17:18
>收件人: <[hidden email]>
>主题: 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: [hidden email] For
>additional commands, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Jsonpath loses its last zero

贾国动
I see, thank you very much!

在 2018/12/6 18:58,“Felix Schumacher”<[hidden email]> 写入:
   
    Am 6. Dezember 2018 10:36:00 MEZ schrieb "贾国动" <[hidden email]>:
    >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
   
    >
    >  
    >
    >发件人: 贾国动 <[hidden email]>
    >答复: JMeter Users List <[hidden email]>
    >日期: 2018年12月6日 星期四 17:18
    >收件人: <[hidden email]>
    >主题: 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: [hidden email] For
    >additional commands, e-mail: [hidden email]
   
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: [hidden email]
    For additional commands, e-mail: [hidden email]
   



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]