Reputation: 63
Is it possible to parse YAML formatted strings with yaml-cpp?
There isn't a YAML::Parser::Parser(std::string&)
constructor. (I'm getting a YAML string via libcurl from a http-server.)
Upvotes: 6
Views: 4787
Reputation: 66194
In the new version, you can parse a string directly (see here):
YAML::Node node = YAML::Load("[1, 2, 3]");
Upvotes: 9
Reputation: 58372
Try using a stringstream:
std::string s = "name: YAML from libcurl";
std::stringstream ss(s);
YAML::Parser parser(ss);
Upvotes: 9