Expand my Community achievements bar.

Announcing the launch of new sub-community for Campaign Web UI to cater specifically to the needs of Campaign Web UI users!

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"
        }
    }
}