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.

Created attachment 33862[details]
Extract JSON Objects as JSON Strings
Keep PostProcessor clean by moving the stringification into the JSONManager.
It would be good, if the interface of JSONManager would show, that it returns a list of Strings. But as it is a public interface it seems to be to late to change it now.

There is an additional use case in which the extractedObject is an instanceof JSONArray rather than a Map (JSONObject).
I propose updating the JSONManager stringifyJSONObject the following:
private String stringifyJSONObject(Object obj) {
if (obj instanceof JSONArray) {
return ((JSONArray) obj).toJSONString();
} else if (obj instanceof Map) {
return new JSONObject((Map<String, ?>) obj).toJSONString();
}
return obj == null ? "" : obj.toString(); //$NON-NLS-1$
}
An example would be:
{
"saveInto": [
"string1"
]
}
using JSONPath:
$.saveInto
I'm not sure how you create the attachments or I would do it for you.

This is ASF Bugzilla: the Apache Software Foundation bug system. In case
of problems with the functioning of ASF Bugzilla, please contact
bugzilla-admin@apache.org.
Please Note: this e-mail address is only for reporting problems
with ASF Bugzilla. Mail about any other subject will be silently
ignored.