This advice should be qualified. I live in outer London in a mid-century house. My garden soil has been collecting lead-laden dust for most of those years until leaded petrol was outlawed. If I were to plant directly in the soil, there is no telling how many heavy metals would be pulled into the vegetables.
Not to mention, I was digging one day and about 3 feet down I found a discarded television. What else could be buried there? Did the previous owners operate an illegal motorcycle repair yard? There could be gallons upon gallons of who knows what in the dirt. I've heard stories about the next door garden which was used to breed all manner of house pets. Dogs, hamsters, rabbits and snakes. Then there are the pesticides from the perfectly manicured gardens that one might inherit when buying a house. Although I think they degrade after a short while (could be wrong about that)
Point being... if you're in the city DO NOT just plant in the earth. I suppose you could get the soil tested, but I'd rather spend an afternoon and a little bit of money on lumber and build the boxes. And free compost from reliable sources is easy to find on the internet.