/** * Parse JSON * @param value Data to be parsed * @returns If it is valid JSON it will return an object otherwise it will return the original type or throw an error. */ export function silentlyParseJson(value: string) { try { return JSON.parse(value); } catch (error) { return value; } }