# AssertionError: expected ' ' to deeply equal

**URL:** <https://community.postman.com/t/assertionerror-expected-to-deeply-equal/22977>\
**Category:** Help Hub\
**Tags:** tests, variables, collections, json\
**Created:** [April 22, 2021, 12:55pm UTC](https://community.postman.com/t/assertionerror-expected-to-deeply-equal/22977 "2021-04-22T12:55:50Z")\
**Posts on this page:** 17\
**Page:** 3

<div class="post-metadata">

**Author:** ![payload-observer-938](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/payload-observer-938/32/14332_2.png) [@payload-observer-938](https://community.postman.com/u/payload-observer-938)\
**Post date:** [January 4, 2023, 5:13am UTC](https://community.postman.com/t/assertionerror-expected-to-deeply-equal/22977/42 "2023-01-04T05:13:02Z")

</div>

![20230104_104043](https://us1.discourse-cdn.com/getpostman/original/3X/b/5/b51ad52cefdda15a21aaa99486583346da223d00.jpeg)  
 ![20230104_104018](https://us1.discourse-cdn.com/getpostman/original/3X/5/1/516624ae6f3282c7a5bd0d2bdf2c320b64e1e721.jpeg)  
 ![20230104_103952](https://us1.discourse-cdn.com/getpostman/original/3X/f/8/f8f06f45e96c4de9b71192a91b4d63560b79ebbc.jpeg)  
@sseenivasan89 Please have a look!

---

<div class="post-metadata">

**Author:** ![payload-observer-938](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/payload-observer-938/32/14332_2.png) [@payload-observer-938](https://community.postman.com/u/payload-observer-938)\
**Post date:** [January 4, 2023, 9:07am UTC](https://community.postman.com/t/assertionerror-expected-to-deeply-equal/22977/43 "2023-01-04T09:07:44Z")

</div>

Waiting for your response @sseenivasan89 Sir

---

<div class="post-metadata">

**Author:** ![sseenivasan89](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/sseenivasan89/32/8350_2.png) [@sseenivasan89](https://community.postman.com/u/sseenivasan89)\
**Post date:** [January 4, 2023, 10:53am UTC](https://community.postman.com/t/assertionerror-expected-to-deeply-equal/22977/44 "2023-01-04T10:53:28Z")

</div>

the response body comes as empty

---

<div class="post-metadata">

**Author:** ![payload-observer-938](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/payload-observer-938/32/14332_2.png) [@payload-observer-938](https://community.postman.com/u/payload-observer-938)\
**Post date:** [January 4, 2023, 11:04am UTC](https://community.postman.com/t/assertionerror-expected-to-deeply-equal/22977/45 "2023-01-04T11:04:40Z")

</div>

What to do next @sseenivasan89 Sir?

---

<div class="post-metadata">

**Author:** ![sseenivasan89](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/sseenivasan89/32/8350_2.png) [@sseenivasan89](https://community.postman.com/u/sseenivasan89)\
**Post date:** [January 4, 2023, 11:48am UTC](https://community.postman.com/t/assertionerror-expected-to-deeply-equal/22977/46 "2023-01-04T11:48:03Z")

</div>

investigate why the response is empty

---

<div class="post-metadata">

**Author:** ![ppoorna](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@ppoorna](https://community.postman.com/u/ppoorna)\
**Post date:** [January 4, 2023, 11:50am UTC](https://community.postman.com/t/assertionerror-expected-to-deeply-equal/22977/47 "2023-01-04T11:50:05Z")

</div>

Correct, reason i did is to ensure that – this error shouldn’t come **expected undefined to deeply equal 10080** and as you mentioned – pm.expect(multiAcctNum).to.eql(10080); i tried it same error so kindly help me how to fix this error. thank in advance sir.

---

<div class="post-metadata">

**Author:** ![payload-observer-938](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/payload-observer-938/32/14332_2.png) [@payload-observer-938](https://community.postman.com/u/payload-observer-938)\
**Post date:** [January 4, 2023, 12:00pm UTC](https://community.postman.com/t/assertionerror-expected-to-deeply-equal/22977/48 "2023-01-04T12:00:34Z")

</div>

Sir you are correct. But,How to investigate? I am a beginner @sseenivasan89 Sir.

---

<div class="post-metadata">

**Author:** ![sseenivasan89](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/sseenivasan89/32/8350_2.png) [@sseenivasan89](https://community.postman.com/u/sseenivasan89)\
**Post date:** [January 4, 2023, 1:34pm UTC](https://community.postman.com/t/assertionerror-expected-to-deeply-equal/22977/49 "2023-01-04T13:34:55Z")

</div>

talk to your developer and check why no response is coming  
what is the status code you are getting ?

---

<div class="post-metadata">

**Author:** ![payload-observer-938](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/payload-observer-938/32/14332_2.png) [@payload-observer-938](https://community.postman.com/u/payload-observer-938)\
**Post date:** [January 4, 2023, 2:47pm UTC](https://community.postman.com/t/assertionerror-expected-to-deeply-equal/22977/50 "2023-01-04T14:47:46Z")

</div>

@sseenivasan89 Sir I am doing it from a YouTube channel. You must have heard of Pavan Kumar Sir. Response code coming is 200 i.e. OK.  
Please tell how to proceed.

---

<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:** [January 5, 2023, 10:15am UTC](https://community.postman.com/t/assertionerror-expected-to-deeply-equal/22977/51 "2023-01-05T10:15:44Z")

</div>

@payload-observer-938

The response is showing a blank array. Nothing else.

Therefore it looks like there is something wrong with the request.

The API is showing a 200 code as technically I guess a blank array is valid JSON.

We will know nothing about that API, so this will be something for the trainer\supplier.

---

<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:** [January 5, 2023, 10:19am UTC](https://community.postman.com/t/assertionerror-expected-to-deeply-equal/22977/52 "2023-01-05T10:19:36Z")

</div>

@ppoorna

Similar to the advice given to others. You need to post an example response and the corresponding tests tab.

If its coming back undefined, then you are not targeting the element correctly in the response.

---

<div class="post-metadata">

**Author:** ![payload-observer-938](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/payload-observer-938/32/14332_2.png) [@payload-observer-938](https://community.postman.com/u/payload-observer-938)\
**Post date:** [January 5, 2023, 10:28am UTC](https://community.postman.com/t/assertionerror-expected-to-deeply-equal/22977/53 "2023-01-05T10:28:45Z")

</div>

Thanks @michaelderekjones Sir  
Just wanted to know how you mastered Postman? I mean how I as a beginner should i approach and proceed.

---

<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:** [January 5, 2023, 10:40am UTC](https://community.postman.com/t/assertionerror-expected-to-deeply-equal/22977/54 "2023-01-05T10:40:53Z")

</div>

@payload-observer-938

I’m still learning Postman.

However, I have a background in technical support and testing in particular.

As a beginner, I would recommend starting with the Learning Center.

[Postman Galaxy Training | Postman API Network](https://www.postman.com/postman/workspace/postman-galaxy-training/overview)

Run through the “APIs 101 Training”, then the “Testing and Automation Training” course.

You need to use the console log for troubleshooting. (This is covered in the training).

Postman uses JavaScript under the hood, so having a basic understanding of JavaScript will be advantageous. The WC3 Schools is a good place to start. In particular, the use of JavaScript objects and arrays.

Finally, you need to have a decent understanding of REST which is a standard that a lot of API’s are developed to. This will include learning and understanding JSON.

When you parse the response using pm.response.json(), it converts the JSON to a JavaScript object. Hence you need to learn both when you are trying to target elements.

JSON can be complex, which can return JavaScript objects within objects, within arrays. So you need to learn what you are looking at and how to target the elements.

You should also look into Soap and XML which is an older but still widely used method.

---

<div class="post-metadata">

**Author:** ![dkrock](https://avatars.discourse-cdn.com/v4/letter/d/f0a364/32.png) [@dkrock](https://community.postman.com/u/dkrock)\
**Post date:** [April 20, 2023, 3:34am UTC](https://community.postman.com/t/assertionerror-expected-to-deeply-equal/22977/55 "2023-04-20T03:34:53Z")

</div>

Hi All - can you please help me below issue , i am getting below error while validating response body

code-  
pm.test(“json data validation”,() =\>{  
var jsonData = pm.response.json();  
pm.expect(jsonData.first\_name).to.eql(“Janet”);  
});

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

error  
**“json data validation | AssertionError: expected undefined to deeply equal 'Janet”**

---

<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:** [April 26, 2023, 10:39am UTC](https://community.postman.com/t/assertionerror-expected-to-deeply-equal/22977/56 "2023-04-26T10:39:15Z")

</div>

@dkrock

I would recommend posting this as its own question, rather than tagging it on the end of an already answered thread (which is probably why no-one has answered).

You haven’t posted an example response, so I can’t tell you exactly what you need to put, but the issues is related to ‘jsonData.first\_name’ being undefined, so this is not targeting that element correctly and is what you need to check.

---

<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:** [April 27, 2023, 12:59pm UTC](https://community.postman.com/t/assertionerror-expected-to-deeply-equal/22977/57 "2023-04-27T12:59:30Z")

</div>

@dkrock Welcome to the community!!

When the JSON parsing couldn’t locate the element it will throw this “undefined” error. Please check if the xpath is right. You can use [https://jsonpathfinder.com/](https://jsonpathfinder.com/)

---

<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:** [August 25, 2023, 9:56am UTC](https://community.postman.com/t/assertionerror-expected-to-deeply-equal/22977/58 "2023-08-25T09:56:55Z")

</div>

Closed on August 25, 2023, 9:56am UTC

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

[Previous page](https://community.postman.com/t/assertionerror-expected-to-deeply-equal/22977.md?page=2)
