• Ingrid Vanherpen 5
  • NEWBIE
  • 30 Points
  • Member since 2019

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 7
    Replies
Hello All,
I hope someone can help me to format my JSON string This is what I have.
String tmpSetBody = '{\"personalizations\":[{\"to\":[{\"email\":\"'+recipient+'\",\"name\":\"'+recipient+'\"}],\"subject\":\"TestTestTest '+emailSubject + ' ' + candidate+'\"}],\"from\":{\"email\":\"support@email.com\",\"name\":\"Support\"},\"reply_to\":{\"email\":\"support@email.com\",\"name\":\"support\"},\"content\":[{\"type\":\"text/plain\",\"value\":\"'+body+'"\"}]})';
This is the result when using the system.debug and the development console:
tmpSetBody= {"personalizations":[{"to":[{"email":"myemail@mail.com","name":"First Name"}],"subject":"TestTestTest Modify existing card:  123"}],"from":{"email":"support@email.com","name":"Support"},"reply_to":{"email":"support@Email.com","name":"support"},"content":[{"type":"text/plain","value":"Modify  card: 123 Card Limit: 550.00

And this is how it should look:
tmpSetBody2= {"personalizations":[{"to":[{"email":"myemail@glofin.com","name":"support"}],"subject":"TestTestTest Modify existing card:  123"}],"from":{"email":"support@email.com","name":"support"},"reply_to":{"email":"support@email.com","name":"support"},"content":[{"type":
"text/plain","value":"Modify  card: 123 Card Limit: 550.00"}]})

It seems I am missing the ending brackets and quote, but everything I have tried does not seem to work.
Thanks,
Keith.
 
Hello All,
I hope someone can help me to format my JSON string This is what I have.
String tmpSetBody = '{\"personalizations\":[{\"to\":[{\"email\":\"'+recipient+'\",\"name\":\"'+recipient+'\"}],\"subject\":\"TestTestTest '+emailSubject + ' ' + candidate+'\"}],\"from\":{\"email\":\"support@email.com\",\"name\":\"Support\"},\"reply_to\":{\"email\":\"support@email.com\",\"name\":\"support\"},\"content\":[{\"type\":\"text/plain\",\"value\":\"'+body+'"\"}]})';
This is the result when using the system.debug and the development console:
tmpSetBody= {"personalizations":[{"to":[{"email":"myemail@mail.com","name":"First Name"}],"subject":"TestTestTest Modify existing card:  123"}],"from":{"email":"support@email.com","name":"Support"},"reply_to":{"email":"support@Email.com","name":"support"},"content":[{"type":"text/plain","value":"Modify  card: 123 Card Limit: 550.00

And this is how it should look:
tmpSetBody2= {"personalizations":[{"to":[{"email":"myemail@glofin.com","name":"support"}],"subject":"TestTestTest Modify existing card:  123"}],"from":{"email":"support@email.com","name":"support"},"reply_to":{"email":"support@email.com","name":"support"},"content":[{"type":
"text/plain","value":"Modify  card: 123 Card Limit: 550.00"}]})

It seems I am missing the ending brackets and quote, but everything I have tried does not seem to work.
Thanks,
Keith.