mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-10 22:54:05 -08:00
11 lines
209 B
TypeScript
11 lines
209 B
TypeScript
|
|
||
|
export function validateJSON(json: string | undefined): any { // tslint:disable-line:no-any
|
||
|
let result;
|
||
|
try {
|
||
|
result = JSON.parse(json!);
|
||
|
} catch (exception) {
|
||
|
result = undefined;
|
||
|
}
|
||
|
return result;
|
||
|
}
|