On 14 March 2012 16:06, Pulkit Singhal <[email protected]> wrote:
> 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:

Which BSF language are you using?

> // 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?

This is not really a JMeter question; JMeter just invokes the language
using the BSF API.

You might get more informed comment if you ask on the appropriate
language user list.

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

Reply via email to