# AssertionError: expected undefined to deeply equal +0

**URL:** <https://community.postman.com/t/assertionerror-expected-undefined-to-deeply-equal-0/62458>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [June 20, 2024, 11:21am UTC](https://community.postman.com/t/assertionerror-expected-undefined-to-deeply-equal-0/62458 "2024-06-20T11:21:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![orbital-module-ast26](https://avatars.discourse-cdn.com/v4/letter/o/7ea924/32.png) [@orbital-module-ast26](https://community.postman.com/u/orbital-module-ast26)\
**Post date:** [June 20, 2024, 11:21am UTC](https://community.postman.com/t/assertionerror-expected-undefined-to-deeply-equal-0/62458/1 "2024-06-20T11:21:15Z")

</div>

When running the below script -

```
var jsonData=pm.response.json();
pm.expect(jsonData.id).to.eql(pm.environment.get("userid_env"));

```

I am getting the below error.

test the values of json fields | AssertionError: expected undefined to deeply equal +0

please help on this

---

<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:** [June 20, 2024, 11:30am UTC](https://community.postman.com/t/assertionerror-expected-undefined-to-deeply-equal-0/62458/2 "2024-06-20T11:30:36Z")

</div>

Hey @orbital-module-ast26 👋

Welcome to the Postman Community! :postman:

What’s the response body of that request? This `jsonData.id` is _undefined_ is that in the response body?

Do you have the environment file selected? What is the value of `pm.environment.get("userid_env")`?

Using the Postman Console will help you here and show what data is returned in the `jsonData` variable, from there you can see if the reference to the `id` is correct.

---

<div class="post-metadata">

**Author:** ![orbital-module-ast26](https://avatars.discourse-cdn.com/v4/letter/o/7ea924/32.png) [@orbital-module-ast26](https://community.postman.com/u/orbital-module-ast26)\
**Post date:** [June 20, 2024, 11:45am UTC](https://community.postman.com/t/assertionerror-expected-undefined-to-deeply-equal-0/62458/3 "2024-06-20T11:45:32Z")

</div>

Thank you for the quick reply. I am new to the postman.

I am getting the below data in the response body

{“type”:“[RFC 7231 - Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content](https://tools.ietf.org/html/rfc7231#section-6.5.4%22,%22title%22:%22Not) Found”,“status”:404,“traceId”:“00-5b5e100540cacf44b93eaad4e329c72f-1f3a219d4b05a141-00”}

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [June 20, 2024, 12:19pm UTC](https://community.postman.com/t/assertionerror-expected-undefined-to-deeply-equal-0/62458/4 "2024-06-20T12:19:52Z")

</div>

It would appear that you are getting a 404 not found status code for your response, so that is the first issue to resolve.

You need to check your request to confirm that you are sending the correct details.

No one here can help you with that unless you post details of the request, plus details on the API specification to ensure correctness.

If you are new to Postman, then I would suggest a visit to the Learning Centre.

[Overview | Postman Learning Center](https://learning.postman.com/docs/introduction/overview/)

Including the Postman Training links under “Resources”.

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

I would recommend the “Galaxy APIs 101” course first as it gets you used to the application features.

Then the “Galaxy Testing and Automation” course which teaches you how to assert the responses. It includes verifying status codes.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [July 20, 2024, 12:19pm UTC](https://community.postman.com/t/assertionerror-expected-undefined-to-deeply-equal-0/62458/5 "2024-07-20T12:19:52Z")

</div>

Closed on July 20, 2024, 12:19pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
