I agree with what you said.
I considered JSONSerialization
, that was the reason for this question. It is still not in the new open-source swift Foundation though (which is another constraint).
In the future I would like to add reading of more variety of JSON structures. Having data warehousing and data quality background, I do not trust anything that is foreign. Sometimes added complexity is necessary to either make the reading more tolerable (with sensible defaults and default transformations) or at least to give me and the user more precise error information with potential contextual/semantic hints. Raw JSON gives that possibility for the cost of added complexity.
Codable
is great for structures that I have full control of, especially if I am their originator. It is also great for ephemeral data, that live just enough to be moved around. Not so great for something that is intended for long term storage where the original application is expected to evolve or when there might be different "foreign" applications producing the data.
However, reading foreing structuers is tangential topic to this post, I diverted slightly.