export const safeJSONParse = (str, defaultValue = {}) => { try { return JSON.parse(str); } catch (e) { return defaultValue; } }; export const safeJSONStringify = (obj, defaultValue = '{}') => { try { return JSON.stringify(obj); } catch (e) { return defaultValue; } };