8 lines
128 B
TypeScript
8 lines
128 B
TypeScript
|
export function parseJson<T = any>(input: string) {
|
||
|
try {
|
||
|
return JSON.parse(input) as T
|
||
|
} catch {
|
||
|
return null
|
||
|
}
|
||
|
}
|