# AssertionError: expected undefined to deeply equal 'fiction'

**URL:** <https://community.postman.com/t/assertionerror-expected-undefined-to-deeply-equal-fiction/29983>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [November 23, 2021, 7:10am UTC](https://community.postman.com/t/assertionerror-expected-undefined-to-deeply-equal-fiction/29983 "2021-11-23T07:10:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shekhar87](https://avatars.discourse-cdn.com/v4/letter/s/c5a1d2/32.png) [@shekhar87](https://community.postman.com/u/shekhar87)\
**Post date:** [November 23, 2021, 7:10am UTC](https://community.postman.com/t/assertionerror-expected-undefined-to-deeply-equal-fiction/29983/1 "2021-11-23T07:10:44Z")

</div>

pm.test(“API working”, function(){

```
pm.response.to.have.status("OK")

```

});

pm.test(“Filtered book details:-”, function(){

```
var jsonData = pm.response.json();

pm.expect(jsonData.type).to.eql("fiction");

```

})

In Console, Response body is like

[{“id”:1,“name”:“The Russian”,“type”:“fiction”,“available”:true},{“id”:3,“name”:“The Vanishing Half”,“type”:“fiction”,“available”:true},{“id”:4,“name”:“The Midnight Library”,“type”:“fiction”,“available”:true},{“id”:6,“name”:“Viscount Who Loved Me”,“type”:“fiction”,“available”:true}]

---

<div class="post-metadata">

**Author:** ![bbahadur](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@bbahadur](https://community.postman.com/u/bbahadur)\
**Post date:** [November 23, 2021, 9:50am UTC](https://community.postman.com/t/assertionerror-expected-undefined-to-deeply-equal-fiction/29983/2 "2021-11-23T09:50:38Z")

</div>

Hey @shekhar87! Welcome to the community 🥳

Seems like there is some issue with accessing the response,

```auto
var jsonData = pm.response.json();

```

Maybe try logging the response and check, also if you could share the response you are getting then it’ll help the community help you faster.
