2-Year-Old Boy and Dog Rescued From Hot Car After Grandmother Accidentally Locked Them Inside

New Jersey State Police posted dashcam video of the dramatic rescue.

A 2-year-old boy and a puppy were rescued from a hot car in New Jersey after the child's grandmother accidentally locked the keys inside the vehicle.

Read: Mom Accused of Leaving Kids in Car for 15 Hours Allegedly Said, 'They'll Cry Themselves to Sleep'

Deputies posted dashcam footage of the incident at Hammonton Township last week that shows Troopers Jacob Sherry and Steven Hodge breaking the windows of a car, and carrying the boy and dog to safety.

They had apparently been locked inside the car for 30 minutes before their rescue, as temperatures in the area reached 84 degrees.

“It’s a good reminder to parents and caretakers everywhere to be aware when securing children and animals and that you secure your keys,” Trooper Lawrence Peele of the New Jersey State Police told InsideEdition.com.

Deputies said the woman had finished loading her grandson and dog in the backseat of her car when she went to get into the driver’s seat, and realized she had left the keys in the passenger seat, locking her out of the car.

The grandmother immediately dialed 911.

Read: Great-Grandmother, 70, Recounts 5 Days Trapped in Car Before Dramatic Rescue: 'This Isn't Real'

When deputies arrived on the scene, they suggested breaking the window, since it was a hot day and the boy was visibly sweating. The grandmother agreed.

After he was removed from the car, the boy was brought to the air-conditioned patrol car to cool off until an ambulance arrived on the scene.

Peele said both the child and the dog are in good condition following the incident.

Watch: Cop Who Left Police Dog in Hot Patrol Car Also Investigated in Fatal Shooting of Previous K9: