Add strict mode to JSON parser (#6536)

This commit is contained in:
David McKay
2019-10-23 22:06:39 +01:00
committed by Daniel Nelson
parent 41d6a1a787
commit a9a0d4048a
4 changed files with 51 additions and 1 deletions

View File

@@ -89,6 +89,9 @@ type Config struct {
// default timezone
JSONTimezone string `toml:"json_timezone"`
// Whether to continue if a JSON object can't be coerced
JSONStrict bool `toml:"json_strict"`
// Authentication file for collectd
CollectdAuthFile string `toml:"collectd_auth_file"`
// One of none (default), sign, or encrypt
@@ -164,6 +167,7 @@ func NewParser(config *Config) (Parser, error) {
TimeFormat: config.JSONTimeFormat,
Timezone: config.JSONTimezone,
DefaultTags: config.DefaultTags,
Strict: config.JSONStrict,
},
)
case "value":