0

On an ASP.NET Core 2.2 project I am serialising the following Dictionary:

var stats = new Dictionary<Category, Int32> {
  { new Category { Id = 1, Name = "A" }, 1 }, 
  { new Category { Id = 2, Name = "B" }, 2 } 
};

However in my Json I get the following:

"stats": {
  "MyProj.Category": 1,
  "MyProjCategory": 2
},

How to serialize dictionaries?

Miguel Moura
  • 36,732
  • 85
  • 259
  • 481

0 Answers0