examples/server-config.json is what FSON is for — a configuration file a person maintains.

// Example service configuration.
// Demonstrates the typical use of FSON for hand-edited config files.
{
  service_name: "billing",

  database: {
    host: "db.internal.example", // production endpoint
    port: 5432,
    --user: "root", /* disabled credential, kept for reference */
    "connection timeout": 2.50,
    options: ["sslmode=require", "application_name=billing"]
  },

  retries: [
    1,
    2, // quick retries first
    5,
    30
    // give up after the last delay
  ],

  scale_factor: 1.2e+3,
  enabled: true,
  --debug: false,
  motto: "zügig parsen 🚀"
  /* end of configuration */
}
// reviewed 2026-06

Points of interest

ConstructNotePage
two leading // linesheader comments — attached to the document, written back above the {Document structure
host: … // production endpointa trailing comment — stays on the member's lineComments
--user: "root"a disabled member — the credential is kept for reference but invisible to queries
"connection timeout":a key with a space — must be quoted; still reachable as a path: "database.connection timeout"Keys, dotted paths
retries[] with per-element comments and a dangling // give up…array element trivia round-tripsValues
2.50, 1.2e+3lexemes kept exactlyNumbers
🚀 written as 🚀 in the sourcesurrogate pair → decoded to one code point; re-emitted as raw UTF-8Strings & escapes
/* end of configuration */ before } and // reviewed 2026-06 afterdangling + footer commentsComments

Querying it

This is the file the User Guide › Querying page works against:

auto r = Fson::load( "server-config.json" );
auto& d = *r.document;

d.getString ( "database.host", "" );                    // "db.internal.example"
d.getInteger( "database.port", 0 );                     // 5432
d.getDouble ( "database.connection timeout", 0.0 );     // 2.5
d.getInteger( "retries[3]", 0 );                        // 30
d.getString ( "database.user", "none" );               // "none" — disabled
d.getBoolean( "debug", true );                          // true — disabled, fallback used

Editing it safely

d.setPath( "database.host", std::make_unique<String>( "db-eu.internal.example" ) );
Fson::save( d, "server-config.json" );

Only database.host changes on disk. Every comment — header, trailing, dangling, footer — and the exact spelling of 2.50 and 1.2e+3 are untouched.