# Data type double assertion

**URL:** <https://community.postman.com/t/data-type-double-assertion/59976>\
**Category:** Help Hub\
**Tags:** tests, variables\
**Created:** [April 15, 2024, 2:15pm UTC](https://community.postman.com/t/data-type-double-assertion/59976 "2024-04-15T14:15:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kayal1postman](https://avatars.discourse-cdn.com/v4/letter/k/a698b9/32.png) [@kayal1postman](https://community.postman.com/u/kayal1postman)\
**Post date:** [April 15, 2024, 2:15pm UTC](https://community.postman.com/t/data-type-double-assertion/59976/1 "2024-04-15T14:15:09Z")

</div>

I need to check if the data type of the variable is double from the response. Please assist if the code is correct ?  
“Dat”: {  
“C”: [  
{  
“T”: “dfd”,  
“C”: “D”,  
“Amount”: {  
“Amount”: 23.7  
}  
},

the code written is :  
pm.expect(json.Dat.C[0].Amount.Amount).to.be.a(‘double’);

I am getting failed and the reason is :AssertionError: expected 23.7 to be a double…

Is the mean that 23.7 derived in the response isn’t it double and they developed with some other data type? Please guide

---

<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 15, 2024, 4:23pm UTC](https://community.postman.com/t/data-type-double-assertion/59976/2 "2024-04-15T16:23:09Z")

</div>

Postman uses the Chaijs library for assertions.

[Expect / Should - Chai (chaijs.com)](https://www.chaijs.com/api/bdd/)

In particular…

[Method a](https://www.chaijs.com/api/bdd/#method_a)

Which in turn uses “typedetect”.

[GitHub - chaijs/type-detect: Improved typeof detection for node.js and the browser.](https://github.com/chaijs/type-detect)

I can’t see double anywhere in that list, but as its not erroring I’m not 100% sure.

What does typeof think that variable is?

```auto
console.log(typeof(json.Dat.C[0].Amount.Amount));

```

---

<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:** [May 15, 2024, 4:24pm UTC](https://community.postman.com/t/data-type-double-assertion/59976/3 "2024-05-15T16:24:08Z")

</div>

Closed on May 15, 2024, 4:24pm UTC

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