Keep the form, bend the content
Every genre has conventions audiences have absorbed without trying: the slow zoom before a reveal, the swelling music at a heroic moment, the narrator who speaks in serious, gravelly tones. Parody uses those conventions as a stage and drops something unsuitable onto it.
Airplane! (1980), written and directed by Jim Abrahams and David and Jerry Zucker, is the classic example. It reproduces the look and rhythm of a 1950s airline disaster film almost exactly, and casts actors known for serious roles, including Leslie Nielsen. They deliver absurd lines with total sincerity. The joke depends on nobody in the film realising it is a comedy.
Nielsen took the same deadpan approach into The Naked Gun (1988), parodying the hard-boiled police drama. The genre stayed intact; the detective simply misunderstood everything around him with complete confidence.

