JSON and line breaks for text version of email?

SOLVED
Go to solution
JohnS799
Frequent Participant

JSON and line breaks for text version of email?

I'm trying to create a new campaign via the CC API through:

 

https://api.constantcontact.com/v2/emailmarketing/campaigns

 

I find I have to "flatten" the JSON I send so there are no line breaks in it anywhere, and then it posts correctly.

 

But how do I preserve line breaks in the text_content part of the email if I have to flatten the JSON that contains that part...and flatten the text_content as a result too?

 

Thanks for your help!

1 ACCEPTED SOLUTION
DaveBerard
Moderator

You can use the ASCII encoding for line breaks (\n) which is reserved in JSON as a line break.  For other reserved JSON characters, see this website: http://json.org/

Dave Berard
Senior Product Manager, Constant Contact

View solution in original post

2 REPLIES 2
DaveBerard
Moderator

You can use the ASCII encoding for line breaks (\n) which is reserved in JSON as a line break.  For other reserved JSON characters, see this website: http://json.org/

Dave Berard
Senior Product Manager, Constant Contact

View solution in original post

JohnS799
Frequent Participant

Thanks, David!

Developer Portal

View API documentation, code samples, get your API key.

Visit Page