# How do I format a a pm.response() test to include a an IP in the request?

**URL:** <https://community.postman.com/t/how-do-i-format-a-a-pm-response-test-to-include-a-an-ip-in-the-request/3496>\
**Category:** Help Hub\
**Created:** [December 5, 2018, 6:00pm UTC](https://community.postman.com/t/how-do-i-format-a-a-pm-response-test-to-include-a-an-ip-in-the-request/3496 "2018-12-05T18:00:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rchoate](https://avatars.discourse-cdn.com/v4/letter/r/a87d85/32.png) [@rchoate](https://community.postman.com/u/rchoate)\
**Post date:** [December 5, 2018, 6:00pm UTC](https://community.postman.com/t/how-do-i-format-a-a-pm-response-test-to-include-a-an-ip-in-the-request/3496/1 "2018-12-05T18:00:56Z")

</div>

I’m using postman to test a router for the state of a peer router. I expect it to return a status of “Established” from the peer router “peerState” key. Normally for these types of tests I used the **pm.response** module but in this case I have a value to get nested under an IP address in the response body like so:

```auto
{
    "jsonrpc": "2.0",
    "id": "show...",
    "result": [
        {
            "routerId": "192.0.2.1",
            "peers": {
                "192.0.2.4": {
                    "msgSent": 21416,
                    "inMsgQueue": 0,
                    "prefixReceived": 0,
                    "upDownTime": 1543940743.718255,
                    "version": 4,
                    "msgReceived": 21420,
                    "prefixAccepted": 0,
                    "peerState": "Established",
                    "outMsgQueue": 0,
                    "underMaintenance": false,
                    "asn": 65001
                },

```

I want to fetch the value in the peerState key but am having difficulty formatting the test:

```auto
pm.test("EVPN neighbor is established", function () {
    pm.expect(pm.response.json().result[0].peers.192.0.2.4.peerState).to.equal("Established");
});

```

Question: how do I format that dotted IP address in the **pm.response** test?

---

<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:** [December 5, 2018, 7:19pm UTC](https://community.postman.com/t/how-do-i-format-a-a-pm-response-test-to-include-a-an-ip-in-the-request/3496/2 "2018-12-05T19:19:32Z")

</div>

You could wrap it in `[]`?

`pm.response.json().result[0].peers["192.0.2.4"]peerState`

---

<div class="post-metadata">

**Author:** ![rchoate](https://avatars.discourse-cdn.com/v4/letter/r/a87d85/32.png) [@rchoate](https://community.postman.com/u/rchoate)\
**Post date:** [December 5, 2018, 10:14pm UTC](https://community.postman.com/t/how-do-i-format-a-a-pm-response-test-to-include-a-an-ip-in-the-request/3496/3 "2018-12-05T22:14:32Z")

</div>

> [@rchoate](#):
>
> pm.test(“EVPN neighbor is established”, function () { pm.expect(pm.response.json().result[0].peers.192.0.2.4.peerState).to.equal(“Established”); });

Totally worked; many thanks. Working version looks like this.

```auto
pm.test("EVPN neighbor: Established", function () {
    pm.expect(pm.response.json().result[0].peers["192.0.2.4"].peerState).to.equal("Established");
});

```
