The reference manual describes the fson public API in a narrative, task-oriented form. The exhaustive machine-produced companion is the generated Doxygen tree.

All types are in namespace fedem::fson; diagnostics reuse fedem::parser::ParseError from the cparse library. Headers are #include "fson/<Name>.hh". The public API is C++17-compatible.

Ownership

Values are owned through std::unique_ptr<Value>. The polymorphic types are neither copyable nor movable — duplicate with clone(), which deep-copies a value and its attached comments. The trivia carriers Member and Element are move-only and also expose clone().

The map

LayerTypesPage
One-line entry pointFson, LoadResultFson, LoadResult
Whole fileDocumentDocument
ContainersObject, ArrayObject, Array
Leaf valuesValue, Null, Boolean, Number, StringValue & leaf types
TriviaComment, CommentList, Key, Member, Element, IncludeComment & CommentList
ParseFsonParserFsonParser
SerializeFsonWriter (Dialect, DisabledMemberPolicy)FsonWriter
DiagnosticsParseErrorParseError

The one-minute version

#include "fson/Fson.hh"
#include "fson/String.hh"
using namespace fedem::fson;

auto r = Fson::load( "config.fson" );
if( r.ok() )
{
  long long port = r.document->getInteger( "database.port", 5432 );
  r.document->setPath( "database.host", std::make_unique<String>( "db1" ) );
  Fson::save( *r.document, "config.fson" );   // every comment intact
}