Short answer
Yes, a 4‑month‑old puppy can have a tiny taste of regular jam, but only in a very small amount. Most jams are just sugar and fruit, which are not toxic to dogs. Avoid sugar‑free varieties that may contain xylitol, and never give grape jam because grapes are poisonous. Watch for vomiting, diarrhea, or lethargy, and contact your vet if any of those appear.
Jam / jelly — Food safety facts
Feed with care · Dogs · full breakdown on the linked food page
Sugar, and sugar-free versions may use xylitol. Grape jam adds grape toxicity.
The full verdict, portion guidance and serving notes are collected on the Jam / jelly food facts page.