Monoatomic-layered carbon materials, such as graphene1 and amorphous monolayer carbon2,3, have stimulated intense fundamental and applied research owing to their unprecedented physical properties and a wide range of promising applications4,5. So far, such materials have mainly been produced by chemical vapour deposition, which typically requires stringent reaction conditions compared to solution-phase synthesis. Herein, we demonstrate the solution preparation of free-standing nitrogen-doped amorphous monolayer carbon with mixed five-, six- and seven-membered (5-6-7-membered) rings through the polymerization of pyrrole within the confined interlayer cavity of a removable layered-double-hydroxide template. Structural characterizations and first-principles calculations suggest that the nitrogen-doped amorphous monolayer carbon was formed by radical polymerization of pyrrole at the α, β and N sites subjected to confinement of the reaction space, which enables bond rearrangements through the Stone-Wales transformation. The spatial confinement inhibits the C-C bond rotation and chain entanglement during polymerization, resulting in an atom-thick continuous amorphous layer with an in-plane π-conjugation electronic structure. The spatially confined radical polymerization using solid templates and ion exchange strategy demonstrates potential as a universal synthesis approach for obtaining two-dimensional covalent networks, as exemplified by the successful synthesis of monolayers of polythiophene and polycarbazole.