Project

General

Profile

Retrieving POST request with content-type application/json

Added by Jake Forsberg over 11 years ago

Retrieving form url encoded POST data is straightforward with Http::Request.getParameter().

Is there a standard mechanism to retrieve parsed JSON requests, or at least retrieve the raw request body to parse the JSON string directly?


Replies (1)

RE: Retrieving POST request with content-type application/json - Added by Koen Deforche over 11 years ago

Hey,

If het POST was not form-url encoded, then you can read and parse the request body from: request.in().

You should convert it to a string if you want to parse it with Wt::Json::parse()

Regards,

koen

    (1-1/1)