beat the rap(Informal)
to avoid being convicted of a certain crime while possibly being guiltyContext:
-Have you heard about Jamies last trial?
-Yes, I have! Has he really been drunk driving?
-Unfortunately, he has. But his lawyer helped him beat the rap on some technical detail.
-He's one reckless but lucky guy…
Category: b, informal, american,crime