Expand my Community achievements bar.

Adobe Campaign User Groups are live now. Join our Adobe Campaign User Groups and connect with your local leaders!

jssp get json data from front end

Avatar

Level 3

How to obtain the JSON data requested by the front end in the JSSP file? I did not obtain it using request.getParameter in the JSSP file,  it only can get data when front end use x-www-form-unlencode

 

2 Replies

Avatar

Community Advisor

hello @wankang,

try :

var body = request.getBodyAsString();
var jsonBody = JSON.parse(body);

 

Br,

Amine

Avatar

Level 3

this is good , but it get 

The code is garbled

{
    "touser""oS-Ze5kbMYNgRT_vqKN9Eg3vOzIk",
    "template_id""2GlZyikWCwsCVlhnUYO-G1of_22mfj3EKbq0SfLn79o",
    "data": {
        "first": {
            "value""????????",
            "color""#173177"
        },
        "keyword1": {
            "value""???",
            "color""#173177"
        }
    }
}