stargaze-studio/utils/json.ts
2022-07-13 16:56:36 +03:00

8 lines
128 B
TypeScript

export function parseJson<T = any>(input: string) {
try {
return JSON.parse(input) as T
} catch {
return null
}
}