Fix parseJSON to return object with error