export function safeJsonParse(data: any): T { if (typeof data === 'string') { try { return JSON.parse(data); } catch (error) { console.error('Failed to parse JSON string:', error); throw new Error('Invalid JSON response from server'); } } return data; } export function logApiResponse(endpoint: string, response: any) { if (__DEV__) { console.log(`[API Response - ${endpoint}]`, JSON.stringify(response, null, 2)); } }