jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pulkit Singhal <pulkitsing...@gmail.com>
Subject Re: How to handle JSON to JS conversion corner cases in JMeter
Date Thu, 15 Mar 2012 13:07:33 GMT
Thank You everyone! Your responses were very helpful. I was using
Javascript in BSF to turn the JSON response into a JS object. The issue
that I saw apparently wasn't really an issue at all. The conversion
happened properly, I was apparently looking at the "view results tree" via
the show as "JSON" formatter. When I looked at it via the show as "Text"
formatter I realized that the actual data was fine. It was just an
additional lens through which I was choosing to view the data ... that made
it seem like there were problems.

On Wed, Mar 14, 2012 at 11:14 AM, karl <karl@sitestress.eu> wrote:

> Did you try
> this:
> https://github.com/smartrics/**JMeterRestSampler<https://github.com/smartrics/JMeterRestSampler>
>
> or this:
> https://github.com/ty1er/**JMeterRestSampler<https://github.com/ty1er/JMeterRestSampler>
>
> or this:
> https://github.com/ATLANTBH/**jmeter-components<https://github.com/ATLANTBH/jmeter-components>
>
> ?
> regards
> karl
>
>
> Am 14.03.2012 17:06, schrieb Pulkit Singhal:
>
>  When JMeter gets back a REST response (fyi - most of the colon symbols are
>> only there for indentation purposes) like this one:
>> :   :   :   :   "fields":
>> :   :   :   :   {
>> :   :   :   :   :   "name":"Here to Stay [RVG Edition]"
>> :   :   :   :   }
>>
>> And the response is run through a BSF PostProcessor like so:
>> // Turn the JSON response into a JS object
>> var response = eval( "(" + prev.getResponseDataAsString() + ")" );
>>
>> Then it ends up parsing the value this way:
>> fields.name =
>> Here to Stay
>> [
>> :   RVG Edition
>> ]
>>
>> It seems to me that the [RVG Edition] inside "Here to Stay [RVG Edition]"
>> is being interpreted as an array based on the above output.
>>
>> Questions:
>> 1) Is my assumption correct?
>> 2) Has anyone run into this kind of corner case before when testing with
>> JMeter?
>> 3) Is eval a bad way to interpret REST responses by converting them into
>> JS
>> objects when it comes to data like this?
>> 4) Is there workaround or an entirely different way to go about processing
>> REST responses?
>>
>>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.**apache.org<user-unsubscribe@jmeter.apache.org>
> For additional commands, e-mail: user-help@jmeter.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message