# Parsing json array variable into body request results in NULL

**URL:** <https://community.postman.com/t/parsing-json-array-variable-into-body-request-results-in-null/28646>\
**Category:** Help Hub\
**Tags:** json, array, json-array-validatio\
**Created:** [October 11, 2021, 2:24pm UTC](https://community.postman.com/t/parsing-json-array-variable-into-body-request-results-in-null/28646 "2021-10-11T14:24:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kverreth](https://avatars.discourse-cdn.com/v4/letter/k/c6cbf5/32.png) [@kverreth](https://community.postman.com/u/kverreth)\
**Post date:** [October 11, 2021, 2:24pm UTC](https://community.postman.com/t/parsing-json-array-variable-into-body-request-results-in-null/28646/1 "2021-10-11T14:24:11Z")

</div>

In postman flow i created a chain where I assign variables from my GET request in order to use them in my next POST request

 ![image](https://us1.discourse-cdn.com/getpostman/original/2X/7/783509fc6eca675c2de61905c3852491d753bde0.png)

A sample of the POST body request:

```auto
{
    "metadata": {
        "configurationVersions": [
            7
        ],
        "clusterVersion": "1.226.116.20211006-093312"
    },
    "id": "f0ec694c-c89e-4735-8821-5f082c522ecf",
    "name": "Host",
    "description": null,
    "rules": [
        {
            "type": "HOST",
            "enabled": true,
            "valueFormat": null,
            "propagationTypes": [],
            "conditions": [
                {
                    "key": {
                        "attribute": "HOST_OS_TYPE",
                        "type": "STATIC"
                    },
                    "comparisonInfo": {
                        "type": "OS_TYPE",
                        "operator": "EXISTS",
                        "value": null,
                        "negate": false
                    }
                }
            ]
        }
    ],
    "entitySelectorBasedRules": []
}

```

Variables assigned:

 ![image](https://us1.discourse-cdn.com/getpostman/original/2X/1/168c83e4754751079ec234233d90bfb66b23b2d4.png)

POST Pre-request Script:

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

POST body:

 ![image](https://us1.discourse-cdn.com/getpostman/original/2X/8/84d71eaa75cc1e501ae491c0529c08e19cf988cb.png)

Requst Body:

 ![image](https://us1.discourse-cdn.com/getpostman/original/2X/4/48b5fa26ea08c0da4d2fe4b1f8beb9033ec781bf.png)

How can I parse the rules and avoid the null value?

---

<div class="post-metadata">

**Author:** ![kitty-garrison](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/kitty-garrison/32/27117_2.png) [@kitty-garrison](https://community.postman.com/u/kitty-garrison)\
**Post date:** [October 13, 2021, 4:43pm UTC](https://community.postman.com/t/parsing-json-array-variable-into-body-request-results-in-null/28646/2 "2021-10-13T16:43:46Z")

</div>

What environment are you setting the variables from the GET response body? Or what would you see if you console logged rules on line 3 in the Pre-req script?

Additionally, it is not necessary to assign the rules or entity to the environment scope since the value is used within the run you could assign it to local scope using `pm.variables.set(name, value)`
