Yaml-cpp parsing lines

Is it possible to parse YAML formatted strings using yaml-cpp?

There is no constructor YAML::Parser::Parser(std::string&) . (I get the YAML string via libcurl from the http server.)

+4
source share
2 answers

Try using stringstream :

 std::string s = "name: YAML from libcurl"; std::stringstream ss(s); YAML::Parser parser(ss); 
+7
source

In the new version, you can directly parse the string (see here ):

 YAML::Node node = YAML::Load("[1, 2, 3]"); 
+3
source

Source: https://habr.com/ru/post/1309452/


All Articles