Precise measurement and characterization of electrostatic potential structures and the concomitant electric fields at nanodimensions are essential to understand and control the properties of modern materials and devices. However, directly observing and measuring such local electric field information is still a major challenge in microscopy. Here, differential phase contrast imaging in scanning transmission electron microscopy with segmented type detector is used to image a p-n junction in a GaAs compound semiconductor. Differential phase contrast imaging is able to both clearly visualize and quantify the projected, built-in electric field in the p-n junction. The technique is further shown capable of sensitively detecting the electric field variations due to dopant concentration steps within both p-type and n-type regions. Through live differential phase contrast imaging, this technique can potentially be used to image the electromagnetic field structure of new materials and devices even under working conditions.