jssp get json data from front end | Community
Skip to main content
wankang
Level 3
May 19, 2023
Question

jssp get json data from front end

  • May 19, 2023
  • 1 reply
  • 853 views

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

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

Amine_Abedour
Community Advisor
Community Advisor
May 19, 2023

hello @wankang,

try :

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

 

Br,

Amine

Amine ABEDOUR
wankang
wankangAuthor
Level 3
May 19, 2023

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