Encode returned response from the API as JSON