In 2013 kidnaping and robberies were quite common; a colleague escaped a kidnaping attempt after a car chase with AK47 fire, some colleagues were extracted covertly from the country when they were incidental witnesses to a gang shooting in the restaurant they were having dinner, I saw in the shopping mall all security guards carrying big, bad shotguns on they back - this is the only country where I saw that, even Israel has less obvious security in place.
Worth mentioning San Jose is reputed as the one dodgy place of 0 interest you should avoid. I was told exactly this by an expat who has been there 20 years and have heard similar elsewhere.
I've heard this from expats and guidebooks written by foreigners, and even some Costa Ricans too
If a normal tourist only sees the blocks around the Ticabus bus station at 11pm and the blocks around the bus stop to their tourist destination then of course it's an ugly city.
However the Escazú, Sabana and San Pedro neighbourhoods are quite nice.
The downtown is functional (while not beautiful), compared to any other of the Central American capitals.
And the downtown main street has wide sidewalks for walking (unlike San Salvador), grid style streets (unlike Tegucigalpa), nice weather (unlike Panama), government offices, hotels, nearby (unlike all the others), and accessible by public transport.
No idea how is it today, it may be a lot better.