# How to decode JSON data in Postman

**URL:** <https://community.postman.com/t/how-to-decode-json-data-in-postman/26181>\
**Category:** Help Hub\
**Created:** [July 27, 2021, 7:55am UTC](https://community.postman.com/t/how-to-decode-json-data-in-postman/26181 "2021-07-27T07:55:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chapperash](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/chapperash/32/9267_2.png) [@chapperash](https://community.postman.com/u/chapperash)\
**Post date:** [July 27, 2021, 7:55am UTC](https://community.postman.com/t/how-to-decode-json-data-in-postman/26181/1 "2021-07-27T07:55:05Z")

</div>

Im new to Postman and API’s but have managed to create the following in Postman to GET my data:

```
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://payments.pabbly.com/api/v1/subscription/60fe59194ffedb5c6');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
 ));
$request->setHeader(array(
  'Authorization' => 'Basic XXXXXXXXXXXXXXX'
));
try {
  $response = $request->send();
  if ($response->getStatus() == 200) {
    echo $response->getBody();
  }
  else {
    echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
    $response->getReasonPhrase();
  }
}
catch(HTTP_Request2_Exception $e) {
  echo 'Error: ' . $e->getMessage();
}

```

My question is, how do i decode the JSON data and present it in a way that looks a bit cleaner?

---

<div class="post-metadata">

**Author:** ![odanylewycz](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/odanylewycz/32/3240_2.png) [@odanylewycz](https://community.postman.com/u/odanylewycz)\
**Post date:** [July 27, 2021, 6:50pm UTC](https://community.postman.com/t/how-to-decode-json-data-in-postman/26181/2 "2021-07-27T18:50:02Z")

</div>

Welcome to the community @chapperash!

Can you show us a screenshot of how the json looks in Postman? The php is good to see but doesn’t help as much for the backend (unless something needs to change there).

Thanks!  
Orest

---

<div class="post-metadata">

**Author:** ![chapperash](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/chapperash/32/9267_2.png) [@chapperash](https://community.postman.com/u/chapperash)\
**Post date:** [July 27, 2021, 7:55pm UTC](https://community.postman.com/t/how-to-decode-json-data-in-postman/26181/3 "2021-07-27T19:55:33Z")

</div>

Sure. Thanks for the help. The JSON is:

```auto
{
    "status": "success",
    "message": "Customer data",
    "data": {
        "company_name": "Test Co",
        "website": "",
        "phone": "",
        "billing_address": {
            "street1": "11, My Street",
            "city": "My City",
            "state": "My State",
            "state_code": "LAN",
            "zip_code": "BB12 7GH",
            "country": "GB"
        },
        "shipping_address": {
            "attention": "",
            "street1": "",
            "street2": "",
            "city": "",
            "state": "",
            "zip_code": "",
            "country": ""
        },
        "portal_status": true,
        "createdAt": "2021-07-26T06:38:04.707Z",
        "updatedAt": "2021-07-26T06:38:52.937Z",
        "id": "60fe584c4ffedb5c645f1bf5",
        "first_name": "Harley",
        "last_name": "Smith",
        "email_id": "harley@mydomain.co.uk"
    }
}

```

Im also wondering how i can just get (for example) the first\_name and last\_name fields rather than everything and then style the output like:

```auto
<div>
<span class="first_name">Harley</span>
<span class="last_name">Smith</span>
</div>

```
