# Postman Tests - JSON.parse(responseBody) show the result in console

**URL:** <https://community.postman.com/t/postman-tests-json-parse-responsebody-show-the-result-in-console/17676>\
**Category:** Help Hub\
**Tags:** test\
**Created:** [November 13, 2020, 10:04am UTC](https://community.postman.com/t/postman-tests-json-parse-responsebody-show-the-result-in-console/17676 "2020-11-13T10:04:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![juergenschubert](https://avatars.discourse-cdn.com/v4/letter/j/54ee81/32.png) [@juergenschubert](https://community.postman.com/u/juergenschubert)\
**Post date:** [November 13, 2020, 10:04am UTC](https://community.postman.com/t/postman-tests-json-parse-responsebody-show-the-result-in-console/17676/1 "2020-11-13T10:04:50Z")

</div>

With Postman Tests I am trying to archive to set some environment variables. Not ofter I do have the question how the response body or the indicidual json field is named and so on so I added some debug into my tests

[//console.log](https://console.log)(“The whole response body:…” +responseBody)

//JSON Array füllen mit dem Response Body

var json1 = JSON.parse(responseBody);

[//console.log](https://console.log)("access\_token: " +json1.access\_token)

//If you know that access\_token is there it’s great

pm.environment.set(“access\_token”, json1.access\_token);

//no I want to show the the whole json structure with  
console.log(“The whole json1 struction after parsing:…” +json1)  
but the result in console is: The whole json1 struction after parsing:…[object Object]

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [November 13, 2020, 10:33am UTC](https://community.postman.com/t/postman-tests-json-parse-responsebody-show-the-result-in-console/17676/2 "2020-11-13T10:33:59Z")

</div>

Hey @juergenschubert,

Welcome to the Community! ⭐

Your question was a little difficult to understand but if you’re just trying to log the parsed response body to the console - You can use this in the `Tests` tab:

```auto
console.log(pm.response.json())

```

This will parse the response and log it in the Console tab and not display this as `[object Object]`.

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/4/b/4bf2e14d0edc54c99b0a15e3e09058d204ed8143.png)

With each request made, you should also see the full response/response details. These are held within different sections and displayed when you click on the request.

More information on the `pm.response.json()` command can be found on our learning center:

> **[Postman JavaScript reference | Postman Learning Center](https://learning.postman.com/docs/writing-scripts/script-references/postman-sandbox-api-reference/#scripting-with-response-data)**
>
> Postman JavaScript reference: documentation for Postman, the collaboration platform for API development. Create better APIs—faster.

---

<div class="post-metadata">

**Author:** ![allenheltondev](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/allenheltondev/32/31738_2.png) [@allenheltondev](https://community.postman.com/u/allenheltondev)\
**Post date:** [November 13, 2020, 12:32pm UTC](https://community.postman.com/t/postman-tests-json-parse-responsebody-show-the-result-in-console/17676/3 "2020-11-13T12:32:17Z")

</div>

To expand on what @danny-dainton said,

`console.log` will display an object or a string at one time, not both. By adding “The whole json1 structure after parsing:” to your log statement, you are telling it you want to display it as a string. Your options to avoid this are:

**Option 1**

```auto
console.log('The whole json1 structure after parsing:...');
console.log(json1)

```

**Option 2**

```auto
console.log('The whole json1 structure after parsing:...', json1);

```

**Option 3**

```auto
console.log('The whole json1 structure after parsing:...' + JSON.stringify(json1))

```
