https://bz.apache.org/bugzilla/show_bug.cgi?id=59609

            Bug ID: 59609
           Summary: JSONPathPostProcessor not evaluating correctly
           Product: JMeter
           Version: 3.0
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HTTP
          Assignee: [email protected]
          Reporter: [email protected]

The JSONPathPostProcessor uses the follow to turn the JSON results to string,
however if toJSONString isn't used then all of the quotes will be removed.


Current Example

With this Code (JSONPostProcessor 166-167):

Object obj = extractedValues.get(0);
String objAsString = obj != null ? obj.toString() : ""; //$NON-NLS-1$

Run with:

$.context

Against:

{
  "context": {
    "#v": "abc123",
    "#t": "string"
  }
}

Results in:

{#v: abc123, #t: string}

This is incorrect, all of the quotes have been removed.

It should be replaced with something more like:

String objAsString = "";
if (extractedValues instanceof JSONArray) {
 objAsString = new JSONObject((Map) extractedValues.get(0)).toJSONString();
}

Which when tested results:

{"#t":"string","#v":"abc123"}

This obviously needs to be extended for examples where more than one response
is returned.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to