Skip to main content
Community site session details

Community site session details

Session Id : +CRGLZFwaFQrvH5+ZeUTiI
Power Automate - Building Flows
Answered

JSON formatting issues

Like (0) ShareShare
ReportReport
Posted on 2 May 2019 21:31:25 by 604

This got marked as spam last time I tried to post, not sure why...

 

Mailchimp allows batch operations, allowing you to complete multiple operations with a single call.  Helpful when dealing with hundreds/thousands of records.  The format of the JSON is causing me a headache though.  This is what it needs to look like (confirmed working in postman)-

 

{
	"operations": 
	[
	{
	"method":"POST",
	"path": "/lists/f8b596c66e/members/",
	"body":"{
 \"email_address\": \"test1@gmail.com\",
 \"status\": \"subscribed\", 
 \"merge_fields\": {
 \"FNAME\": \"Test\",
 \"LNAME\": \"One\",
 \"ADDRESS\": {
 \"addr1\": \"1122 Rad Dr\",
 \"addr2\": \"\",
 \"city\": \"Toledo\",
 \"state\": \"OH\",
 \"zip\": \"12345\",
 \"country\": \"US\"
 },
 \"PHONE\": \"1233047645\",
 \"COMMERCIAL\": 1,
 \"SALUTE\": \"Dear Dan\",
 \"SOURCE\": \"CR\",
 \"ACQUIRED\": \"2019-01-01\",
 \"ARBAL\": \"\",
 \"RAU\": \"\",
 \"EXPIRES\": \"2019-07-01\",
 \"SECONDARYP\": \"1236996491\",
 \"CUSTID\": \"12345\",
 \"LOCATION\": \"1\"
 }
		}	
	"},
	{
	"method":"POST",
	"path": "/lists/f8b596c66e/members/",
	"body":"{
 \"email_address\": \"dan@tech.com\",
 \"status\": \"subscribed\",
 \"merge_fields\": {
 \"FNAME\": \"Dan\",
 \"LNAME\": \"I\",
 \"ADDRESS\": {
 \"addr1\": \"12 Road\",
 \"addr2\": \"\",
 \"city\": \"Toledo\",
 \"state\": \"OH\",
 \"zip\": \"12345\",
 \"country\": \"US\"
 },
 \"PHONE\": \"1233047645\",
 \"COMMERCIAL\": 1,
 \"SALUTE\": \"Dear Dan\",
 \"SOURCE\": \"CR\",
 \"ACQUIRED\": \"2019-01-01\",
 \"ARBAL\": \"\",
 \"RAU\": \"\",
 \"EXPIRES\": \"2019-07-01\",
 \"SECONDARYP\": \"1236996491\",
 \"CUSTID\": \"12345\",
 \"LOCATION\": \"1\"
 }
		}
	"}
	]
}

Looks fun, right?  

 

My problem is that it's adding quotes around part of the JSON I've generated

aia-error3.png

 

 

 

 

 

Relevant part of the flow (if it's not large enough- https://i.imgur.com/tuenGFS.png )-

The Input for Generate Record is a solid block to avoid it adding \n \t in later compose operations.

It also will not accept it as valid JSON without the whole thing inside single quotes, hence the compose action to remove those.  

 

aia-flow.png

 

The ouput from Compose 3 is what I need, I just need to stick this inside the main operations object without it adding the double quotes

 

aia-good.png

 

 

No matter how I try to do that, it will add double quotes around the entire object array (not each array item), as shown above.  Converting it to JSON works, but that strips all the escaped double-quotes, which breaks it anyways.

 

 

Ideas?

 

 

Thanks

 

  • Verified answer
    SCTdan Profile Picture
    604 on 03 May 2019 at 14:14:54
    Re: JSON formatting issues

    I figured this out.  The issue was in trying to put the joined array (becomes a string at that point) back into an array or object variable.  That added the quotes, and I didn't notice, but it also escaped all my escaped characters.

     

    So instead, just write it to a string variable instead, then pass that string variable* as the POST body.  In hindsight, rather simple.  

     

    Lesson learned-  Just because you need to pass an object/array via POST (and you don't need to utilize it as an object/array inside flow anymore), doesn't mean it has to be an object/array inside Flow.  Not really a common issue though, just due to the unique batching syntax in mailchimp.

     

    mc-success.png

    mc-success2.png

     

     

    *You must pass a fully-formed query as a variable, it won't format properly when done like you see in the HTTP body heremc4.png

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1