A C++11 library for parsing and working with YAML documents.
Boost.Yaml provides an idiomatic C++ interface for reading YAML files and accessing their structured contents. The library is designed to be simple, efficient, and standards-compliant.
- C++11 Compatible: Works with modern C++ compilers
- Simple API: Easy-to-use interface for parsing and accessing YAML data
- Header-only Option: Can be used as header-only or compiled library
- Comprehensive Error Handling: Built on Boost.System for robust error reporting
- Well Documented: Complete documentation with examples
- Tested: Comprehensive test suite
#include <boost/yaml.hpp>
#include <iostream>
int main()
{
using namespace boost::yaml;
auto result = parse("name: John\nage: 30");
if(result)
{
auto& v = *result;
if(v.is_mapping())
{
auto& m = v.as_mapping();
std::cout << "Name: " << m["name"].as_scalar() << "\n";
std::cout << "Age: " << m["age"].as_scalar() << "\n";
}
}
return 0;
}
mkdir build
cd build
cmake .. -DBOOST_SRC_DIR=/path/to/boost
cmake --build .
b2
cmake --build . --target test
or with B2:
b2 test
See the documentation for complete API reference and guides.
Distributed under the Boost Software License, Version 1.0. See accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt
Contributions are welcome! Please feel free to submit issues and pull requests.