LaiTool/src/define/Tools/validate.ts

14 lines
278 B
TypeScript
Raw Normal View History

2024-08-03 12:46:12 +08:00
/**
* JSON解析
* @param str
* @returns truefalse
*/
export function ValidateJson(str: string): boolean {
try {
JSON.parse(str);
return true
} catch (e) {
return false;
}
}