Newman: response in json report is not readable

Created on 21 Dec 2018  路  2Comments  路  Source: postmanlabs/newman

  1. Newman Version (can be found via newman -v):4.1.0
  2. OS details (type, version, and architecture):
  3. Are you using Newman as a library, or via the CLI? CLI
  4. Did you encounter this recently, or has this bug always been there:
  5. Expected behaviour:
  6. Command / script used to run Newman: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
  7. Sample collection, and auxiliary files (minus the sensitive details):
  8. Screenshots (if applicable):

I 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,

question

All 2 comments

@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.

Was this page helpful?
0 / 5 - 0 ratings