You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by vj...@varcos.in on 2024/12/07 10:55:44 UTC
Issue in JSON format representation in 'View Results Tree'
Hi all,
I am testing Rest API transaction (FAST-APIs built using Python).
When I get response I see that JSON representation does not match Text view
in 'View Results Tree'.
Attaching both screenshots, the one in Text view is correct while in JSON
view, parameter's sequence gets changed.
Not sure what is the reason, can some one please help, how to get both in
sync?
Regards,
Vikrant Joshi
RE: Issue in JSON format representation in 'View Results Tree'
Posted by vj...@varcos.in.
Thanks Felix for precise explanation. That helped to understand reason for mismatch.
Regards,
Vikrant
From: Felix Schumacher <fe...@internetallee.de>
Sent: 08 December 2024 15:28
To: user@jmeter.apache.org
Subject: Re: Issue in JSON format representation in 'View Results Tree'
Am 08.12.24 um 02:14 schrieb vj@varcos.in <ma...@varcos.in> :
Thanks Felix for quick clarification.
While order of entries don’t matter is a fair point, I am curious to know the reason behind mismatch.
Well, the ordering is an implementation artifact. The JSON component parses the structure and compiles JSON objects into a Java HashMap, which has no order. When that HashMap is displayed, the original order is lost.
The Text display does no parsing at all and thus keeps the ordering of the (characters of the) original message.
Best regards
Felix
Regards,
Vikrant
From: Felix Schumacher <ma...@internetallee.de> <fe...@internetallee.de>
Sent: 07 December 2024 16:53
To: JMeter Users List <ma...@jmeter.apache.org> <us...@jmeter.apache.org>
Subject: Re: Issue in JSON format representation in 'View Results Tree'
In JSON view the result is interpreted by JMeter as JSON and as such the order of the entries (in an object/dict/hash) doesn't matter (to JSON). In Text view the result is shown character for character as it is received.
Why is the difference important to you?
If you want to assert against JSON result, you should use the JSON assertion, which should work without problems disregard of the displayed order. Same is true for extraction with JSON extractor.
I would argue, that ignoring the order in objects/dicts/hashes improves the robustness of the extraction/assertion (and even display) of JSON results.
Best regards
Felix
Am 07.12.24 um 11:55 schrieb vj@varcos.in <ma...@varcos.in> :
Hi all,
I am testing Rest API transaction (FAST-APIs built using Python).
When I get response I see that JSON representation does not match Text view in ‘View Results Tree’.
Attaching both screenshots, the one in Text view is correct while in JSON view, parameter’s sequence gets changed.
Not sure what is the reason, can some one please help, how to get both in sync?
Regards,
Vikrant Joshi
Re: Issue in JSON format representation in 'View Results Tree'
Posted by Felix Schumacher <fe...@internetallee.de>.
Am 08.12.24 um 02:14 schrieb vj@varcos.in:
>
> Thanks Felix for quick clarification.
>
> While order of entries don’t matter is a fair point, I am curious to
> know the reason behind mismatch.
>
Well, the ordering is an implementation artifact. The JSON component
parses the structure and compiles JSON objects into a Java HashMap,
which has no order. When that HashMap is displayed, the original order
is lost.
The Text display does no parsing at all and thus keeps the ordering of
the (characters of the) original message.
Best regards
Felix
> Regards,
>
> Vikrant
>
> *From:*Felix Schumacher <fe...@internetallee.de>
> *Sent:* 07 December 2024 16:53
> *To:* JMeter Users List <us...@jmeter.apache.org>
> *Subject:* Re: Issue in JSON format representation in 'View Results Tree'
>
> In JSON view the result is interpreted by JMeter as JSON and as such
> the order of the entries (in an object/dict/hash) doesn't matter (to
> JSON). In Text view the result is shown character for character as it
> is received.
>
> Why is the difference important to you?
>
> If you want to assert against JSON result, you should use the JSON
> assertion, which should work without problems disregard of the
> displayed order. Same is true for extraction with JSON extractor.
>
> I would argue, that ignoring the order in objects/dicts/hashes
> improves the robustness of the extraction/assertion (and even display)
> of JSON results.
>
> Best regards
>
> Felix
>
> Am 07.12.24 um 11:55 schrieb vj@varcos.in:
>
> Hi all,
>
> I am testing Rest API transaction (FAST-APIs built using Python).
>
> When I get response I see that JSON representation does not match
> Text view in ‘View Results Tree’.
>
> Attaching both screenshots, the one in Text view is correct while
> in JSON view, parameter’s sequence gets changed.
>
> Not sure what is the reason, can some one please help, how to get
> both in sync?
>
> Regards,
>
> Vikrant Joshi
>
RE: Issue in JSON format representation in 'View Results Tree'
Posted by vj...@varcos.in.
Thanks Felix for quick clarification.
While order of entries don’t matter is a fair point, I am curious to know the reason behind mismatch.
Regards,
Vikrant
From: Felix Schumacher <fe...@internetallee.de>
Sent: 07 December 2024 16:53
To: JMeter Users List <us...@jmeter.apache.org>
Subject: Re: Issue in JSON format representation in 'View Results Tree'
In JSON view the result is interpreted by JMeter as JSON and as such the order of the entries (in an object/dict/hash) doesn't matter (to JSON). In Text view the result is shown character for character as it is received.
Why is the difference important to you?
If you want to assert against JSON result, you should use the JSON assertion, which should work without problems disregard of the displayed order. Same is true for extraction with JSON extractor.
I would argue, that ignoring the order in objects/dicts/hashes improves the robustness of the extraction/assertion (and even display) of JSON results.
Best regards
Felix
Am 07.12.24 um 11:55 schrieb vj@varcos.in <ma...@varcos.in> :
Hi all,
I am testing Rest API transaction (FAST-APIs built using Python).
When I get response I see that JSON representation does not match Text view in ‘View Results Tree’.
Attaching both screenshots, the one in Text view is correct while in JSON view, parameter’s sequence gets changed.
Not sure what is the reason, can some one please help, how to get both in sync?
Regards,
Vikrant Joshi
Re: Issue in JSON format representation in 'View Results Tree'
Posted by Felix Schumacher <fe...@internetallee.de>.
In JSON view the result is interpreted by JMeter as JSON and as such the
order of the entries (in an object/dict/hash) doesn't matter (to JSON).
In Text view the result is shown character for character as it is received.
Why is the difference important to you?
If you want to assert against JSON result, you should use the JSON
assertion, which should work without problems disregard of the displayed
order. Same is true for extraction with JSON extractor.
I would argue, that ignoring the order in objects/dicts/hashes improves
the robustness of the extraction/assertion (and even display) of JSON
results.
Best regards
Felix
Am 07.12.24 um 11:55 schrieb vj@varcos.in:
>
> Hi all,
>
> I am testing Rest API transaction (FAST-APIs built using Python).
>
> When I get response I see that JSON representation does not match Text
> view in ‘View Results Tree’.
>
> Attaching both screenshots, the one in Text view is correct while in
> JSON view, parameter’s sequence gets changed.
>
> Not sure what is the reason, can some one please help, how to get both
> in sync?
>
> Regards,
>
> Vikrant Joshi
>