Poly (triazine imide) (PTI) is a material belonging to the group of carbon nitrides and has shown to have competitive properties compared to melon or g-C3N4, especially in photocatalysis. As most of the carbon nitrides PTI is usually synthesized by thermal or hydrothermal approaches. We present and discuss an alternative synthesis for PTI which exhibits a pH dependent solubility in aqueous solutions. This synthesis is based on the formation of radicals during electrolysis of an aqueous melamine solution, coupling of resulting melamine radicals and the final formation of PTI. We applied different characterization techniques to identify PTI as the product of this reaction and report the first liquid state NMR experiments on a triazine-based carbon nitride. We show that PTI has a relatively high specific surface area and a pH dependent adsorption of charged molecules. This tunable adsorption has a significant influence on the photocatalytic properties of PTI which we investigated in dye degradation experiments.