Converted eval to try and JSON.parse in API calls