I've just begun having problems with my door ajar switch,
Spraying the latch with WD-40 is suggested by several people, however if you look at the drawings posted by mrzeee you will see the switch is mounted on the inside of the latch so the latch mechanism blocks it from the outside of the door. Because of this you would be lucky if any of the WD-40 would reach the switch.
The switch is actuated by a horizontal plunger that rides on a cam operated by the door latch (which also blocks spray from the outside). The most effective way of getting to the switch is to bite the bullet ans pull the door panel. That way you can free the plunger and relube the cam effectively.