I'm trying to parse std::list to json::value with casablanca1.2.0 with Visual Studio 2012 and send JSON request with REST service(POST) from C++ application to Java Application.
REST service requires a request DTO like this.
// java
public class MyProfile {
private String name;
private List<String> favoriteFood;
...
}
So I tried to write C++ code, but I couldn't find how to convert std::list to json::value.
// C++
std::wstring name = "AAA";
std::list<std::wstring> favoriteFood = ...;
json::value requestData;
requestData[L"name"] = json::value::string(name);
std::vector<json::value::string> vvv;
for (auto itr = favoriteFood.begin(); itr != favoriteFood.end(); ++itr) {
vvv.push_back(json::value::string(*itr));
}
requestData[L"favoriteFood"] = json::value::array(vvv); // compile error occurs
I'm totally new to Casablanca and JSON, so I can't find any solution.
Any help would be very nice!!!