JSON is a particular file format useful for serialising heirachical data.

Given that D also has an XML module which appears to be deprecated, I wonder if it would be better to write a more abstract serialisation/persistance module that could use either json,xml,some binary format and future formats.

I would estimate that more than 70% of the times, the JSON data will only be read and written by a single D application, with only occasional inspection by developers etc. In these cases it is undesirable to have code littered with types coming from a particular serialisation file format library. As the software evolves that file format might become obsolete/slow/unfashionable etc, and it would be much nicer if the format could be changed without a lot of code being touched. The other 30% of uses will genuinely need raw JSON control when reading/writing files written/read by other software, and this needs to be in Phobos to implement the backends. It would be better for most people to not write their code in terms of JSON, but in terms of the more abstract concept of persistence/serialisation (whatever you want to call it).

Reply via email to