Try to parse json uri encoded strings in inputs

This commit is contained in:
lowlighter
2021-08-12 15:01:09 +02:00
parent 0d40bc6787
commit d52ae85660

View File

@@ -145,10 +145,15 @@ metadata.plugin = async function({__plugins, name, logger}) {
try { try {
value = JSON.parse(value) value = JSON.parse(value)
} }
catch {
try {
value = JSON.parse(decodeURIComponent(value))
}
catch { catch {
logger(`metrics/inputs > failed to parse json : ${value}`) logger(`metrics/inputs > failed to parse json : ${value}`)
value = JSON.parse(defaulted) value = JSON.parse(defaulted)
} }
}
return value return value
} }
//Token //Token