escape line endings before attempting to convert to json