json

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 3 Imported by: 0

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

Top-level JSON keys match flag names using kebab-case, snake_case, or camelCase:

{
  "port": 8080,
  "database_url": "postgres://localhost/db",
  "maxRetries": 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.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrParse indicates a syntax or parsing error in JSON configuration.
	ErrParse = errors.New("json parse error")
)

Functions

func Decode

func Decode(data []byte) (map[string]any, error)

Decode decodes JSON bytes into the generic map[string]any structure the configuration engine matches against flag bindings.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL