static LoadResult Fson::load( std::string const& filename );

Parses filename, resolving every %include directive, and returns a LoadResult.

  • Never throws. A parse error is recorded in result.errors and parsing resynchronises at the next , / } / ]; a failed member value becomes a Null placeholder.
  • result.document is null only when the file cannot be opened. A malformed file still yields a partial Document plus the error list.
  • result.ok() is true when a document was produced and nothing worse than a Warning was recorded — check it before trusting or re-writing the document.
auto result = Fson::load( "config.fson" );

for( auto const& e : result.errors )
  std::cerr << e.filename << ':' << e.line << ':' << e.col
            << ": " << e.message << '\n';

if( !result.ok() )
  return 1;

Document& doc = *result.document;

%include resolution

Before returning, load merges defaults (host wins, shallow), binds aliases, resolves relative targets against the including file's directory, and detects cycles — all reported as errors, never thrown. The resolved document's query view is the merged result; save writes only the host file back. See Include Files and Object — dotted paths (provenance).