Added cleansing code to returned API requests to try to make JSON parsing more resilient.