stargaze-studio/utils/json.ts

8 lines
128 B
TypeScript
Raw Normal View History

2022-07-13 13:56:36 +00:00
export function parseJson<T = any>(input: string) {
try {
return JSON.parse(input) as T
} catch {
return null
}
}