But also, you shouldn’t think of it as writing the same type twice! If you couple your external API and your internal data model you are greatly restricting your domain modelling cability. Even in languages where JSON serialisation works with reflection I would recommend having a distinct definition for the internal and external structure so you can have the optimal structure for each context, dodging the “lowest common decimator” problem.
Hi, what do people use to generate them, I found gserde (edit: and glerd-json)
I wonder why this is preferred over codegen (during build), possibly using some kind of annotations?