export const safeParseJson = <T>(value: string, fallback: T | null = null): T | null => {
  try { return JSON.parse(value) as T; } catch { return fallback; }
};

export const safeParseJsonOrUndefined = <T>(value: string): T | undefined => {
  try { return JSON.parse(value) as T; } catch { return undefined; }
};
