# Unable to save JSON values

**URL:** <https://community.postman.com/t/unable-to-save-json-values/17510>\
**Category:** Help Hub\
**Tags:** newman-project, tests, variables\
**Created:** [November 8, 2020, 9:44pm UTC](https://community.postman.com/t/unable-to-save-json-values/17510 "2020-11-08T21:44:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ArupAcharya](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@ArupAcharya](https://community.postman.com/u/ArupAcharya)\
**Post date:** [November 8, 2020, 9:44pm UTC](https://community.postman.com/t/unable-to-save-json-values/17510/1 "2020-11-08T21:44:20Z")

</div>

Hello,

I am new to Postman. My issue is described below. Kindly suggest.

Hit a request, select one JSON variable/property from Response, if that value is \> 10, fail the assertion in Tests.

When I am trying to save the JSON property, it’s replying back saying it’s Undefined.

I tried parsing too but didn’t work. Also, I tried the below code which didnt work.

pm.test(“Max Temp greater than 10 validation”,function () {  
var jsonData = pm.response.json();  
pm.expect(jsonData.temp\_max).tobeLessthan(10);  
});

---

<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:** [November 8, 2020, 10:10pm UTC](https://community.postman.com/t/unable-to-save-json-values/17510/2 "2020-11-08T22:10:41Z")

</div>

Hey @ArupAcharya

Welcome to the Postman community! 🚀

Could you share an example of the response body, please?

Without seeing the response I’m just guessing here but it _could_ be something like this:

```auto
pm.expect(jsonData["temp_max"]).to.be.below(10);

```

---

<div class="post-metadata">

**Author:** ![ArupAcharya](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@ArupAcharya](https://community.postman.com/u/ArupAcharya)\
**Post date:** [November 8, 2020, 10:40pm UTC](https://community.postman.com/t/unable-to-save-json-values/17510/3 "2020-11-08T22:40:28Z")

</div>

Thanks @danny-dainton. here is the response.

{

```
"coord": {

    "lon": -74.01,

    "lat": 40.71

},

"weather": [

    {

        "id": 800,

        "main": "Clear",

        "description": "clear sky",

        "icon": "01d"

    }

],

"base": "stations",

"main": {

    "temp": 295.74,

    "feels_like": 294.5,

    "temp_min": 294.26,

    "temp_max": 297.15,

    "pressure": 1028,

    "humidity": 36

},

"visibility": 10000,

"wind": {

    "speed": 0.69,

    "deg": 216

},

"clouds": {

    "all": 1

},

"dt": 1604870456,

"sys": {

    "type": 1,

    "id": 4610,

    "country": "US",

    "sunrise": 1604835312,

    "sunset": 1604871871

},

"timezone": -18000,

"id": 5128581,

"name": "New York",

"cod": 200

```

}

---

<div class="post-metadata">

**Author:** ![ArupAcharya](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@ArupAcharya](https://community.postman.com/u/ArupAcharya)\
**Post date:** [November 8, 2020, 10:44pm UTC](https://community.postman.com/t/unable-to-save-json-values/17510/4 "2020-11-08T22:44:01Z")

</div>

@danny-dainton

It still fails with below error.  
Max Temp greater than 10 validation | AssertionError: expected undefined to be a number or a date

---

<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:** [November 8, 2020, 10:47pm UTC](https://community.postman.com/t/unable-to-save-json-values/17510/5 "2020-11-08T22:47:02Z")

</div>

It looks like `temp_max` is inside the `main` object so it would be `jsonData.main["temp_max"]`

---

<div class="post-metadata">

**Author:** ![ArupAcharya](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@ArupAcharya](https://community.postman.com/u/ArupAcharya)\
**Post date:** [November 8, 2020, 10:51pm UTC](https://community.postman.com/t/unable-to-save-json-values/17510/6 "2020-11-08T22:51:54Z")

</div>

It works like a mule.

Thanks very much. Appreciate your quick response. Learnt something tonight. happy to sleep now.
