Hi, I'm trying to convert application/x-www-form-urlencodedreq.body into JSON. I've tried this:
CROW_ROUTE(app, "/register").methods("POST"_method)([](const request& req){
auto x = crow::json::load(req.body);
auto str = crow::json::dump(x);
return str;
});
But, it doesn't work, which makes sense.
1) How can I parse application/x-www-form-urlencoded into JSON?
or
2) How can I convert the req.body to std::string, so that I can "manually" convert it into JSON?
or
3) How can I send a POST request from a form (HTML)? (Note: application/json isn't integrated into HTML yet).
Hi, I'm trying to convert
application/x-www-form-urlencoded
req.body
into JSON. I've tried this:But, it doesn't work, which makes sense. 1) How can I parse
application/x-www-form-urlencoded
into JSON? or 2) How can I convert thereq.body
tostd::string
, so that I can "manually" convert it into JSON? or 3) How can I send aPOST
request from a form (HTML)? (Note:application/json
isn't integrated into HTML yet).Thank you so much, all!