Improved the getData so it leverages $.parseJSON() where possible but has a fallback for malformed JSON strings (for backwards compatibility).