Path syntax

Keys separated by ., array elements as [N] suffixes:

"database.host"   "retries[2]"   "servers[0].port"   "matrix[1][2]"

Only ., [, ] are special — a key with spaces works ("my key.sub"); a key containing . or [ cannot be addressed. Disabled members are invisible. A malformed path resolves to nothing — never an exception.

Path methods

MemberBehaviour
findPath(path) → Value*nullptr when absent or malformed
containsPath(path) → bool
atPath(path) → Value&throws std::out_of_range
setPath(path, value) → Value*replaces or appends; creates missing intermediate objects (bare keys where valid); never creates or grows arrays; never resurrects a disabled member; on failure returns nullptr and leaves the document untouched (intermediates rolled back)
removePath(path) → boolremoves an active member or erases an array element

Typed getters

Fallback used on a missing path or a type mismatch:

MemberTypeNote
getString(path, fallback = "")std::stringnon-String → fallback
getInteger(path, fallback = 0)long longany Number; truncates
getDouble(path, fallback = 0.0)doubleany Number
getBoolean(path, fallback = false)boolBooleans only

Provenance API — where did a resolved value come from?

After Fson::load resolves %include, a path may address a host member or one merged / aliased in from an included file. Write policy is host-only, so these queries let you locate the origin file to edit it there yourself.

MemberBehaviour
isLocal(path) → booltrue when the path resolves to a member physically in the host file
provenanceOf(path) → std::optional<Provenance>nullopt when the path resolves to nothing; else { queryPath, sourceFile, localPath, isHost }sourceFile empty ⇒ host; localPath differs from queryPath for aliases
provenanceMap() → std::vector<Provenance>provenance of every active top-level member