Puerto Rico is pretty safe
Puerto Rico is a safe place to visit, and it is really safer than many US mainland cities. Many regions of the island also have an active police presence to help maintain safety. Simply follow basic safety procedures, such as not walking into dark alleys alone, and you should be fine.
Of course, San Juan, like any other city, has its safer and less safe areas. At night, stay away from La Perla and Puerto de Tierra, which are both close to the Old City. It's also worth noting that since Hurricane Maria hit the island in 2017, there has been a minor spike in crime as the island continues to recover.
One of the most important things to understand before visiting Puerto Rico is how to keep safe. While you may be aware of the crime rates, there is another factor to consider: the island itself! That's correct, you must bear some responsibility for your own health (and survival) during your journey!