# How do I concatenate multiple JSON code blocks?

**URL:** <https://community.postman.com/t/how-do-i-concatenate-multiple-json-code-blocks/11800>\
**Category:** Help Hub\
**Created:** [April 7, 2020, 6:27pm UTC](https://community.postman.com/t/how-do-i-concatenate-multiple-json-code-blocks/11800 "2020-04-07T18:27:20Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsmcdon1](https://avatars.discourse-cdn.com/v4/letter/j/6de8d8/32.png) [@jsmcdon1](https://community.postman.com/u/jsmcdon1)\
**Post date:** [April 7, 2020, 6:27pm UTC](https://community.postman.com/t/how-do-i-concatenate-multiple-json-code-blocks/11800/1 "2020-04-07T18:27:20Z")

</div>

Hello all. I searched the community, but am not sure looping is the answer to my issue. Please advise if I’m wrong. I don’t want to waste anyone’s time.

My issue is this. I am importing customers into a platform and can only import one block of JSON at a time. When I concatenate two blocks of customer info, I get this error:

```auto
{
    "statusCode": 422,
    "type": "validationError",
    "message": "One or more elements is missing or invalid",
    "errors": [
        {
            "field": "",
            "message": "must be a object"
        }
    ]
}

```

As soon as I concatenate another block of the code (sample below), then I get this error. Not sure if this is something I doing wrong in POSTMAN or if the error is coming from the target vendor.  
Here is the code block:

```auto
[
{
    "firstName": "John",
    "lastName": "Doe",
    "birthDate": "1900-01-01",
    "city": "Somewhere",
    "stateCode": "CA",
    "zipCode": "xxxxx",
    "countryCode": "US",
    "emailMarketingStatus": "Subscribed",
	"phones": [{
    "phone": "+1xxxxxxxxxx"
	}],
	"emails": [{
    "email": "somebody@gmail.com"
	}]
}, *********** This is where I concatenate. Individually they work fine.
  {
    "firstName": "Jane",
    "lastName": "Doe",
    "birthDate": "1900-01-01",
    "city": "Somewhere",
    "stateCode": "CA",
    "zipCode": "xxxxx",
    "countryCode": "US",
    "emailMarketingStatus": "Unsubscribed",
	"phones": [{
    "phone": "+1xxxxxxxxxx"
	}],
	"emails": [{
    "email": "xxxxxx@yahoo.com"
	}]
  }
  ]

```

All help is greatly appreciated.

Thank you in advance.

Jeff

---

<div class="post-metadata">

**Author:** ![john.banning1](https://avatars.discourse-cdn.com/v4/letter/j/f04885/32.png) [@john.banning1](https://community.postman.com/u/john.banning1)\
**Post date:** [April 7, 2020, 7:05pm UTC](https://community.postman.com/t/how-do-i-concatenate-multiple-json-code-blocks/11800/2 "2020-04-07T19:05:06Z")

</div>

I was using the JSON Linter here \> [https://jsonlint.com/](https://jsonlint.com/) and it appeared there was something the matter with the &quote;

Here is what I came up with.

```
[
		{
			"firstName": "John",
			"lastName": "Doe",
			"birthDate": "1900-01-01",
			"city": "Somewhere",
			"stateCode": "CA",
			"zipCode": "xxxxx",
			"countryCode": "US",
			"emailMarketingStatus": "Subscribed",
			"phones": [{
				"phone": "+1xxxxxxxxxx"
			}],
			"emails": [{
				"email": "somebody@gmail.com"
			}]
		}, 
		{
			"firstName": "Jane",
			"lastName": "Doe",
			"birthDate": "1900-01-01",
			"city": "Somewhere",
			"stateCode": "CA",
			"zipCode": "xxxxx",
			"countryCode": "US",
			"emailMarketingStatus": "Unsubscribed",
			"phones": [{
				"phone": "+1xxxxxxxxxx"
			}],
			"emails": [{
				"email": "xxxxxx@yahoo.com"
			}]
		}
]
```

---

<div class="post-metadata">

**Author:** ![jsmcdon1](https://avatars.discourse-cdn.com/v4/letter/j/6de8d8/32.png) [@jsmcdon1](https://community.postman.com/u/jsmcdon1)\
**Post date:** [April 7, 2020, 9:54pm UTC](https://community.postman.com/t/how-do-i-concatenate-multiple-json-code-blocks/11800/3 "2020-04-07T21:54:09Z")

</div>

Hey thank you for taking the time to look into this. I used the data you pasted and exact same issue. I ran the code in another JSON analyzer and got “valid”, so I’m going to have to contact the vendor I suppose. Thank you again!

---

<div class="post-metadata">

**Author:** ![singhsivcan](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/singhsivcan/32/1595_2.png) [@singhsivcan](https://community.postman.com/u/singhsivcan)\
**Post date:** [April 8, 2020, 7:38am UTC](https://community.postman.com/t/how-do-i-concatenate-multiple-json-code-blocks/11800/4 "2020-04-08T07:38:38Z")

</div>

@jsmcdon1 How are you sending this data to the back-end?  
Is the body set to Raw with type as JSON?  
Refer the screenshot:

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

---

<div class="post-metadata">

**Author:** ![jsmcdon1](https://avatars.discourse-cdn.com/v4/letter/j/6de8d8/32.png) [@jsmcdon1](https://community.postman.com/u/jsmcdon1)\
**Post date:** [April 9, 2020, 3:57am UTC](https://community.postman.com/t/how-do-i-concatenate-multiple-json-code-blocks/11800/5 "2020-04-09T03:57:38Z")

</div>

Hi. Yes that’s how I’m sending I just got confirmation from the vendor that they can only receive one record at a time. So I need to figure out how to build a loop in postman.

Thanks for your help looking into this for me

---

<div class="post-metadata">

**Author:** ![singhsivcan](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/singhsivcan/32/1595_2.png) [@singhsivcan](https://community.postman.com/u/singhsivcan)\
**Post date:** [April 9, 2020, 6:02am UTC](https://community.postman.com/t/how-do-i-concatenate-multiple-json-code-blocks/11800/6 "2020-04-09T06:02:44Z")

</div>

@jsmcdon1 Got it. I suggest you read through this: [Building workflows in Postman using Collection Runner](https://learning.postman.com/docs/postman/collection-runs/building-workflows/) and this should solve your problem.

Along with that, you might need to work with a [data file to send in your JSON request body](https://learning.postman.com/docs/postman/collection-runs/working-with-data-files/) for every iteration.

---

<div class="post-metadata">

**Author:** ![jsmcdon1](https://avatars.discourse-cdn.com/v4/letter/j/6de8d8/32.png) [@jsmcdon1](https://community.postman.com/u/jsmcdon1)\
**Post date:** [April 9, 2020, 1:52pm UTC](https://community.postman.com/t/how-do-i-concatenate-multiple-json-code-blocks/11800/7 "2020-04-09T13:52:02Z")

</div>

Great. Thank you so much.

---

<div class="post-metadata">

**Author:** ![singhsivcan](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/singhsivcan/32/1595_2.png) [@singhsivcan](https://community.postman.com/u/singhsivcan)\
**Post date:** [April 10, 2020, 12:38pm UTC](https://community.postman.com/t/how-do-i-concatenate-multiple-json-code-blocks/11800/8 "2020-04-10T12:38:03Z")

</div>

Closed on April 10, 2020, 12:38pm UTC


