Correct invalid JSON and remove whitespace