# Incorrect parsing of JSON file when using Runner

**URL:** <https://community.postman.com/t/incorrect-parsing-of-json-file-when-using-runner/76967>\
**Category:** Help Hub\
**Tags:** variables, json\
**Created:** [March 14, 2025, 1:10pm UTC](https://community.postman.com/t/incorrect-parsing-of-json-file-when-using-runner/76967 "2025-03-14T13:10:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![montgoj4](https://avatars.discourse-cdn.com/v4/letter/m/c57346/32.png) [@montgoj4](https://community.postman.com/u/montgoj4)\
**Post date:** [March 14, 2025, 1:10pm UTC](https://community.postman.com/t/incorrect-parsing-of-json-file-when-using-runner/76967/1 "2025-03-14T13:10:10Z")

</div>

I am attempting to submit a JSON-formatted array of JSON payloads for sequential processing using the Runner. However, the logs show a different Request Payload than the one I am trying to submit.

A genericized example of my input file contents is this (I wish to process each policyInformation element in a separate request):

```auto
[
    {
        "policyInformation": {
            "policyNumber": "policyNumber",
            "producer": {
                "type": "type",
                "producerNumber": "producerNumber"
            }
        },
        "driverInformation": {
            "drivers": [
                {
                    "firstName": "firstName",
                    "middleName": "middleName",
                    "lastName": "lastName"
                },
                {
                    "firstName": "firstName",
                    "middleName": "middleName",
                    "lastName": "lastName"
                }
            ]
        }
    },
    {
        "policyInformation": {
            "policyNumber": "policyNumber",
            "producer": {
                "type": "type",
                "producerNumber": "producerNumber"
            }
        },
        "driverInformation": {
            "drivers": [
                {
                    "firstName": "firstName",
                    "middleName": "middleName",
                    "lastName": "lastName"
                }
            ]
        },
        "transactionType": "transactionType"
    }
]

```

I am using a variable as my request body:

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/8/4/846eac8f1eb8a51353689bb4719833502615bb91.png)

This is my pre-request script (at the request level):

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

When i select the file postman does recognize the 2 iterations:

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

My requests are failing due to invalid payload. The logged payload restructured from what I am trying to send. This is the logged payload:

```auto
{
    "id": "c100a6a3-8f25-4103-8e2a-093f8440d185",
    "values": [
        {
            "type": "any",
            "value": {
                "policyNumber": "policyNumber",
                "producer": {
                    "type": "type",
                    "producerNumber": "producerNumber"
                }
            },
            "key": "policyInformation"
        },
        {
            "type": "any",
            "value": {
                "drivers": [
                    {
                        "firstName": "firstName",
                        "middleName": "middleName",
                        "lastName": "lastName"
                    },
                    {
                        "firstName": "firstName",
                        "middleName": "middleName",
                        "lastName": "lastName"
                    }
                ]
            },
            "key": "driverInformation"
        }
    ]
}

```

---

<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:** [March 14, 2025, 2:48pm UTC](https://community.postman.com/t/incorrect-parsing-of-json-file-when-using-runner/76967/2 "2025-03-14T14:48:55Z")

</div>

When you retrieve the current iteration, it should be toObject(), not toJSON().

```auto
let currentIteration = pm.iterationData.toObject();
console.log(currentIteration);
pm.environment.set("payload", JSON.stringify(currentIteration));
// pm.request.body.raw = JSON.stringify(currentIteration); // option 2

```

---

<div class="post-metadata">

**Author:** ![montgoj4](https://avatars.discourse-cdn.com/v4/letter/m/c57346/32.png) [@montgoj4](https://community.postman.com/u/montgoj4)\
**Post date:** [March 14, 2025, 5:59pm UTC](https://community.postman.com/t/incorrect-parsing-of-json-file-when-using-runner/76967/3 "2025-03-14T17:59:15Z")

</div>

This worked. Thank you!
