Skip to content
Marcus Ackre Medina edited this page Jul 20, 2026 · 3 revisions

MarcusMedina.IO.JsonFile

A simple, type-safe way to save and load objects as JSON files — hides serialization plumbing behind a clean interface.

dotnet add package MarcusMedina.IO.JsonFile

Why this exists

Back in 2009, while I was in my second year of studies myself and working as a supervisor for first-year students, I wrote the first version of this to show them what object-oriented programming was actually good for — not just theory about classes and encapsulation, but a real class that hides the messy plumbing behind a clean interface. It doubled as a lifesaver in their own coursework: a lot of them were writing small games at the time, and this gave them an easy way to save and reload progress without having to think about serialisation themselves.

In this case, I wanted the whole save/load story to disappear behind two lines of code, so the lesson stayed about OOP, not about JSON.

Who this is for

  • New to C#? A clean example of what "hide the plumbing behind a class" actually looks like in practice — save/load an object in two lines, no serialization details to learn first.
  • Professional? Lightweight config/state persistence for CLI tools, prototypes, and small apps where spinning up a database is overkill.

Pages

Quick Example

using MarcusMedina.IO.JsonFile;

var settings = new JsonFile<AppSettings>("settings");
settings.Data.Volume = 80;
settings.Save();

var reloaded = new JsonFile<AppSettings>("settings");
Console.WriteLine(reloaded.Data.Volume); // 80

Links

Clone this wiki locally