使用CPR C++请求库发送NLHMMAN JSON有效载荷的最佳方法 我尝试用两个C++库将JSON对象发布到外部服务器:和
在python中,我只需使用requests.postrl,json=data就可以做到这一点 有没有一种简单的方法可以将nlohmann::json类转换为cpr::POST所需的等效cpr::Payload?您希望这样做: 在json对象上使用cpr::Body和,而不是使用cpr::Payload使用CPR C++请求库发送NLHMMAN JSON有效载荷的最佳方法 我尝试用两个C++库将JSON对象发布到外部服务器:和,c++,C++,在python中,我只需使用requests.postrl,json=data就可以做到这一点 有没有一种简单的方法可以将nlohmann::json类转换为cpr::POST所需的等效cpr::Payload?您希望这样做: 在json对象上使用cpr::Body和,而不是使用cpr::Payload auto r = cpr::Post(cpr::Url{"http://www.httpbin.org/post"}, cpr::Body{"This is
auto r = cpr::Post(cpr::Url{"http://www.httpbin.org/post"},
cpr::Body{"This is raw POST data"},
cpr::Header{{"Content-Type", "text/plain"}});