Fixed result JSON parser

This commit is contained in:
frikky
2020-10-14 12:06:19 +02:00
parent 5dd78a3fb4
commit aae38c215b
+6 -3
View File
@@ -5538,14 +5538,17 @@ const AngularWorkflow = (props) => {
// FIXME: The latter replace doens't really work if ' is used in a string // FIXME: The latter replace doens't really work if ' is used in a string
var showResult = data.result.trim() var showResult = data.result.trim()
showResult = showResult.split(" None").join(" \"None\"") showResult = showResult.split(" None").join(" \"None\"")
showResult = showResult.split(" False").join(" false")
showResult = showResult.split(" True").join(" true")
showResult = showResult.split("\'").join("\"") showResult = showResult.split("\'").join("\"")
var jsonvalid = true var jsonvalid = true
try { try {
const tmp = String(JSON.parse(showResult)) const tmp = String(JSON.parse(showResult))
if (!tmp.includes("{") && !tmp.includes("[")) { //if (!tmp.includes("{") && !tmp.includes("[")) {
jsonvalid = false // console.log("IN HERE")
} // jsonvalid = false
//}
} catch (e) { } catch (e) {
jsonvalid = false jsonvalid = false
} }