Documentation
¶
Index ¶
Constants ¶
View Source
const ParserFormat string = "JSON"
ParserFormat defines the standard identifier and file extension target for this provider.
View Source
const XERR_PKGCTX_PARSER xerrors.ErrorCode = "XCONFIG.PARSER.JSON"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser implements the xconfig.Parser interface to read, parse, and merge data from structured JSON configuration files.
func NewParser ¶
func NewParser() *Parser
NewParser instantiates an unconfigured pointer to a JSON Parser.
func (*Parser) Read ¶
Read processes all matched JSON configuration files, loads their byte content into memory, and unmarshals the syntax structures into a single consolidated generic map.
Key behaviors:
- Loops through every identified path and aggregates properties into a shared map workspace.
- Safely bypasses empty file documents instead of failing or erasing previous updates.
- Note: Complex nested object trees inside JSON fields are captured as map[string]any. For consistent flat-key overrides (e.g. key.subkey), input files should adopt flattened properties.
Returns a merged generic map of configurations, or an error if any file read or syntax decoding fails.
Click to show internal directories.
Click to hide internal directories.