I have this below json from this below code


"SMTPMessage":"{"Source":"MITS_LOG", "Machine":"ATL1S07WSLOT042"}"

Now i want to make it as a single string like below


How can we do it in ampscript.



I would use Guide Template Language to parse your JSON object in conjunction with AMPscript. So your code would look like this:

var @SMTPMessage
set @SMTPMessage = Field(@row,"SMTPMessage")

  {{.datasource SMTPMessage type=variable}}
  { "target" : "@SMTPMessage" }



Note that if you are using this on a CloudPage, you need to reset delimiters in OMM by adding this line after your AMPscript block:

%%{={{ }}=}%%

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.