djkah11 djkah11 - 1 year ago 95
JSON Question

Get json from Wt::Http::Request& request

I have problem with json request :(
I have class

class ForumCreate : public Wt::WResource

and function

virtual void handleRequest(const Wt::Http::Request& request, Wt::Http::Response& response)

request.contentType() is application/json.
How do I get json from request?(

Maybe I should use something else to get json?
Task: User send http-request with json on static url. I need to analize json file and send json-response.

Answer Source

You're going to need to parse the data from the input stream provided by

std::istream & Wt::Http::Request::in    (       )   const

It should be the raw json text.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download