In essence, smart grids are electrical networks that transmit and distribute electricity in a reliable, effective manner using information and communication technology (ICT). Trust and security are of the utmost importance. False data injection (FDI) attacks are one of the most serious new security problems, and they can drastically raise the price of the energy distribution process. However, rather than smart grid infrastructures, the majority of current research focuses on FDI defenses for conventional electricity networks. By utilizing spatial-temporal correlations between grid components, we create an effective and real-time technique to identify FDI attacks in smart grids called a deep learning framework. We show that the suggested method offers an accurate and dependable solution using realistic simulations based on the smart grid compared to the benchmarked techniques.