>>107162667
If it was automatable it would be in a library. Are you talking about automating your type autism?
>json
I don't use json, but here is a program+programming language written in c the headers of which you could easily use. https://github.com/jqlang/jq/blob/master/src/jq.h
As for why we choose not to use libraries to solve trivial problems it's to let the reader/maintain know that the program isn't about manipulating json. Or rather that the basic primitives of the program are function that manipulate json, but not serialize. Hence you might need to know (what writing) toJson() but you don't need to know (what writing) serialize_struct() means further than the name and i/o