What is the fundamental difference between
const json_response = pm.response.json()
and
json_response = JSON.parse(responseBody)
In the Postman sandbox context, JSON.parse(responseBody)
and pm.response.json()
is doing the same thing.
The pm.*
API hasn't been in the product the whole time and was introduced to cover lots of different actions that users would normally take when accessing things like, the response body.
Previously, users would use JSON.parse(responseBody)
in the sandbox environment to get this data.
Here's the full list of the pm.*
API methods but this can also be seen in the app with the auto-suggestion feature when you type pm.
https://learning.postman.com/docs/writing-scripts/script-references/postman-sandbox-api-reference/
I would personally recommend that you use the pm.repsonse.json()
method in the app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With