nastiness has 7 distinct synonyms spread across 2 of its 3 senses. Each sense below keeps its own list, because a synonym belongs to a meaning and not to a word: swapping one sense's substitute into another sense's sentence is how a thesaurus makes writing worse. Its one recorded opposite is niceness.
Counts are distinct word forms across every sense. A synonym that appears under three senses is counted once here and shown three times below, under each sense it belongs to.
a state characterized by foul or disgusting dirt and refuse
malevolence by virtue of being malicious or spiteful or nasty
the quality of being highly unpleasant
“I flinched at the nastiness of his wound”
Synonyms, antonyms and the broader and narrower relations for nastiness come from Princeton University’s WordNet. Full sources and licences.