# AssertionError: expected undefined to deeply equal 'ville'

**URL:** <https://community.postman.com/t/assertionerror-expected-undefined-to-deeply-equal-ville/27386>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [September 1, 2021, 8:09pm UTC](https://community.postman.com/t/assertionerror-expected-undefined-to-deeply-equal-ville/27386 "2021-09-01T20:09:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ps198478320](https://avatars.discourse-cdn.com/v4/letter/p/5fc32e/32.png) [@ps198478320](https://community.postman.com/u/ps198478320)\
**Post date:** [September 1, 2021, 8:09pm UTC](https://community.postman.com/t/assertionerror-expected-undefined-to-deeply-equal-ville/27386/1 "2021-09-01T20:09:18Z")

</div>

Hi,  
i have a GET request which returns:

```auto
[
    {
        "idFacture": "d7b8a9b-64f0-45ae-964d-1a1e13ac878d",
        "nom": "Paul",
        "courriel": "paul@example.com",
        "types": [
            "ville",
            "pays",
            "nuage",
            "paradis",
            "espace",
            "mars",
            "univers"
        ]
    }
]

```

I want to add asertion for nom.  
i tried this:

```auto
pm.test("Your test name", function () {
    var jsonData = JSON.parse(responseBody);
    pm.expect(jsonData.nom).to.eql("paul");
});

```

It returns:  
AssertionError: expected undefined to deeply equal ‘paul’

Any help please.  
Thank you

---

<div class="post-metadata">

**Author:** ![bpricilla](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/bpricilla/32/6511_2.png) [@bpricilla](https://community.postman.com/u/bpricilla)\
**Post date:** [September 2, 2021, 2:55am UTC](https://community.postman.com/t/assertionerror-expected-undefined-to-deeply-equal-ville/27386/2 "2021-09-02T02:55:41Z")

</div>

@ps198478320 Hello 🥳

The error which you have faced is one of the common one we face when handling with JSON with arrays. So if you give it as

```auto
pm.test("Your test name", function () {
    var jsonData = JSON.parse(responseBody);
    pm.expect(jsonData[0].nom).to.eql("paul");
});

```

Please try this 😊

For bigger response this [tool](https://jsonpathfinder.com/) might actually help you 🙌

Please read my blog [here](https://bpricilla.medium.com/how-to-easily-locate-your-json-object-in-your-api-response-647549ee8b2) which might help you with JSON parsing.

All the best! Please do let me know if you still face any issues here 😉

---

<div class="post-metadata">

**Author:** ![ps198478320](https://avatars.discourse-cdn.com/v4/letter/p/5fc32e/32.png) [@ps198478320](https://community.postman.com/u/ps198478320)\
**Post date:** [September 7, 2021, 5:37pm UTC](https://community.postman.com/t/assertionerror-expected-undefined-to-deeply-equal-ville/27386/3 "2021-09-07T17:37:24Z")

</div>

Thank you so much @bpricilla
