SSJS Landing Page access POST JSON Request payload

Based on this thread. I have form that is generated by the contents of several data extensions. The contents in these are meant to be editable, so the form can be changed without diving into the actual code at all. The handler needs to receive the contents of the form, but I can't get Platform.Request.GetPostData() parse into a json object. Using the code from the previous thread, I just get a raw post string and nothing else.

How do I use AMPScript or SSJS to convert raw post data into either an array or json?

EDIT: To clarify, I'm trying to get key-value pairs.

  • Are you able to provide a sample of the output from the function? Quite surprisingly I couldn't get the function work on a Cloud Page – Amtera Jun 17 '18 at 19:27
  • I think I just misunderstood how it functioned to begin with. I was not posting a JSON payload and I was expecting the function in that previous thread to parse an HTML post INTO a JSON object. Now I understand that I need to post it using AJAX and serialize it into a JSON object before the post. It is currently outputting: Email=*my email*&SoB_001=false&SoB_002=false&SoA_001=false&SoA_002=false&SoA_003=false – Matt Goldstein Jun 18 '18 at 14:37

Your Answer

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

Browse other questions tagged or ask your own question.