export const jsonParse = (str?: string, defaultValue?: T): Undefinable => { const trimStr = str?.trim(); try { const parsedValue = JSON.parse(trimStr ?? ''); return parsedValue === undefined ? defaultValue : parsedValue; } catch (e) { return defaultValue; } };