Lines 25-32
import org.apache.commons.lang3.StringUtils;
Link Here
|
25 |
import org.apache.jmeter.samplers.SampleResult; |
25 |
import org.apache.jmeter.samplers.SampleResult; |
26 |
import org.apache.jmeter.util.JMeterUtils; |
26 |
import org.apache.jmeter.util.JMeterUtils; |
27 |
|
27 |
|
|
|
28 |
import net.minidev.json.JSONArray; |
28 |
import net.minidev.json.JSONObject; |
29 |
import net.minidev.json.JSONObject; |
29 |
import net.minidev.json.JSONStyle; |
30 |
import net.minidev.json.JSONStyle; |
|
|
31 |
import net.minidev.json.JSONValue; |
30 |
import net.minidev.json.parser.JSONParser; |
32 |
import net.minidev.json.parser.JSONParser; |
31 |
import net.minidev.json.parser.ParseException; |
33 |
import net.minidev.json.parser.ParseException; |
32 |
|
34 |
|
Lines 57-63
public class RenderAsJSON extends SamplerResultTab implements ResultRenderer {
Link Here
|
57 |
public static String prettyJSON(String json) { |
59 |
public static String prettyJSON(String json) { |
58 |
return prettyJSON(json, TAB_SEPARATOR); |
60 |
return prettyJSON(json, TAB_SEPARATOR); |
59 |
} |
61 |
} |
60 |
|
62 |
|
61 |
/** |
63 |
/** |
62 |
* Pretty-print JSON text |
64 |
* Pretty-print JSON text |
63 |
* @param json input text |
65 |
* @param json input text |
Lines 71-76
public class RenderAsJSON extends SamplerResultTab implements ResultRenderer {
Link Here
|
71 |
if (o instanceof JSONObject) { |
73 |
if (o instanceof JSONObject) { |
72 |
return ((JSONObject) o) |
74 |
return ((JSONObject) o) |
73 |
.toJSONString(new PrettyJSONStyle(tabSeparator)); |
75 |
.toJSONString(new PrettyJSONStyle(tabSeparator)); |
|
|
76 |
} else if (o instanceof JSONArray) { |
77 |
return ((JSONArray) o) |
78 |
.toJSONString(new PrettyJSONStyle(tabSeparator)); |
79 |
} else if (o instanceof JSONValue) { |
80 |
return ((JSONValue) o) |
81 |
.toJSONString(new PrettyJSONStyle(tabSeparator)); |
74 |
} |
82 |
} |
75 |
} catch (ParseException e) { |
83 |
} catch (ParseException e) { |
76 |
return json; |
84 |
return json; |