diff --git a/dolphinscheduler-ui/src/utils/json.ts b/dolphinscheduler-ui/src/utils/json.ts index 3ce941ddb5..347486ad6e 100644 --- a/dolphinscheduler-ui/src/utils/json.ts +++ b/dolphinscheduler-ui/src/utils/json.ts @@ -19,17 +19,11 @@ * Verify if it is in json format */ const isJson = (str: string) => { - if (typeof str === 'string') { - try { - const obj = JSON.parse(str) - if (typeof obj === 'object' && obj) { - return true - } else { - return false - } - } catch (e) { - return false - } + try { + const obj = JSON.parse(str) + return !!(typeof obj === 'object' && obj && !Array.isArray(obj)) + } catch (e) { + return false } }