serve someone right

📖 general
Meaning
To receive just punishment or consequences for one's actions.
Literal Meaning
To serve someone the appropriate outcome for their behavior.
Example
“When he cheated on the test, it served him right when he got caught.”