microserve::yaml::yaml_parser class

Line-oriented YAML parser that emits JSON.

Walks preprocessed lines, tracks indentation, and builds mappings, sequences, scalars, and embedded JSON blocks.

Constructors, destructors, conversion operators

yaml_parser(std::istream& is) explicit
Construct a parser from a YAML input stream.

Public functions

auto parse() -> nlohmann::json
Parse the preprocessed YAML document into JSON.

Function documentation

microserve::yaml::yaml_parser::yaml_parser(std::istream& is) explicit

Construct a parser from a YAML input stream.

Parameters
is Stream of raw YAML text.

Reads is and preprocesses it so subsequent parse calls can walk the prepared lines.

nlohmann::json microserve::yaml::yaml_parser::parse()

Parse the preprocessed YAML document into JSON.

Returns JSON object for the document root.
Exceptions
std::runtime_error If the YAML structure is invalid.

Walks the prepared lines and builds mappings, sequences, and scalars (including nested structures).