cal.pub0.org/apps/web/lib/jsonUtils.ts

12 lines
233 B
TypeScript
Raw Normal View History

export const validJson = (jsonString: string) => {
try {
const o = JSON.parse(jsonString);
if (o && typeof o === "object") {
return o;
}
} catch (e) {
console.log("Invalid JSON:", e);
}
return false;
};