Documentation
¶
Overview ¶
Package json provides the JSON configuration decoder for CONGA applications.
Register Decode with conga.App.RegisterDecoder to enable JSON configuration support:
app.RegisterDecoder(".json", json.Decode)
Key Mapping ¶
A top-level JSON key matches a flag's config tag as written or, when it has no tag, the flag name spelled in the app's key casing (conga.ConfigKeyCase, kebab-case by default). Other spellings and letter cases are unknown fields:
{
"port": 8080,
"database-url": "postgres://localhost/db",
"max-retries": 5
}
Strictness ¶
Decoding follows encoding/json/v2 semantics and rejects inputs that RFC 8259 leaves ambiguous: duplicate object member names and invalid UTF-8 in strings are errors rather than silently accepted. Reported errors carry the byte offset and JSON pointer of the offending value. Syntax errors, trailing content after the first JSON document, and non-object top-level values wrap ErrParse. A JSON null document decodes to an empty map.
Numbers ¶
Numbers are decoded from their literal text rather than through float64, so integers bind exactly. An integer literal decodes to int64, or to uint64 when it exceeds the int64 range. A literal with a fraction or exponent decodes to float64. An integer outside both 64-bit ranges, or a number that overflows float64, wraps ErrParse.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrParse indicates a syntax or parsing error in JSON configuration. ErrParse = errors.New("json parse error") )
Functions ¶
Types ¶
This section is empty.