Browse Source

[Fix-16786][Datasource] Fix jdbc connect parameters json validation question (#16787)

dev
小可耐 3 weeks ago committed by GitHub
parent
commit
a68c2a6aa2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 16
      dolphinscheduler-ui/src/utils/json.ts

16
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
}
}

Loading…
Cancel
Save