newman -v):4.1.0I ran newman like "newman run suixi.postman_collection.json -e prod_r.postman_environment.json --reporters cli,html,json,junit --reporter-json-export ./report/$datename.json --reporter-junit-export ./report/$datename.xml --reporter-html-export ./report/$datename.html --ignore-redirects --delay-request 200 --timeout-request 60000 --timeout-script 900000"
In the json report, response is not readable, it's a ascii array.How to get string response
"response":
"id": "06bcada6-f8a1-4532-a244-4c90c6822b54",
"status": "OK",
"code": 200,
"header": [
{
"key": "Date",
"value": "Wed, 19 Dec 2018 16:10:04 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=UTF-8"
},
{
"key": "Transfer-Encoding",
"value": "chunked"
},
{
"key": "Connection",
"value": "keep-alive"
}
],
"stream": {
"type": "Buffer",
"data": [
123,
34,
99,
111,
100,
101,
34,
58,
48,
44,
34,
115,
105,
103,
110,
34,
58,
34,
101,
120,
116,
101,
110,
100,
80,
97,
114,
97,
109,
61,
37,
55,
@Roger535 You can load the JSON file and convert the response to string using:
const report = require('./report/$datename.json');
var responseBuffer = Buffer.from(report.run.executions[0].response.stream);
var responseString = responseBuffer.toString();
Yes I can. But it is not efficient for me. I need to process JSON file with TSQL. This makes newman useless for any automation.