A medieval city wouldn't build on marshland.
Archaic humans regularly drained marshland, especially to use the fertile soil. If that's not what's happening, they'd built this on a coast, not in a marshy delta
To do this properly you'd need modern technology, not only to use appropriately rot-proof materials, but to sink any supports you need, deep into the earth. Imagine a town on top of an oil-derrick. That.
You'd need a piledriver:
https://en.m.wikipedia.org/wiki/Pile_driver
Capable of reaching a suitable foundation.
And rather than an area of firm ground that you build houses on (houses on an oil derrick), these people would build a stilt-town, with seperate pilings for each building. They'd use rope and plank walkways between buildings and boats/canoes/kayaks to get around, otherwise.
That's more reasonable, but again, they'd need a good reason to do this.
But lets put that aside, and assume that there's some really, really, really, important reason why they want to build a town, and they want it here. They'd use rot-resistant woods. Which wood depends on where they live:
*Domestic Species
Exceptionally resistant: black locust, red mulberry, osage orange, and Pacific yew.
Resistant or very resistant: old-growth bald cypress, catalpa, cedar (either eastern or western red cedar), black cherry, chestnut, junipers, honey locust, white oak, old-growth redwood, sassafras, and black walnut.
Tropical Species
Exceptionally resistant: angelique, azobe, balata, goncalo alves, greenheart, ipe (iapacho), jarrah, lignumvitae, purpleheart, and old-growth teak.
Resistant or very resistant: aftomosia (kokrodua), apamate (roble), balau, Spanish cedar, courbaril, determa, iroko, kapur, karri, kempas, American mahogany, manni, secupira, and wallaba.*
https://garden.org/learn/articles/view/977/