Let me set the stage for this post first. Peergroups.be, the sharing economy website I develop for the non-profit WijDelen, is based on ASP.NET MVC. So I have a bunch of Controller classes with methods that end with return View(model);. Our first goal was to have a web application running as quickly as possible. Now that we have a stable system with active users, we’re looking into writing a mobile app. The mobile app can have the same pages/screens as

I recently had to generate a JSON Web Token (JWT) as a response from an login request to an api. The idea is to POST the user’s credentials from a mobile app, and to respond with a JWT. The mobile app can then verify that the user has logged in correctly. A quick introduction to JWT But let’s step out for a moment. What is a JWT exactly? According to jwt.io, a JSON Web Token is an open, industry standard

Update: In the 7.x release of Json.NET, a DictionaryKeyResolver was added that might be able to fix this problem too. I haven’t used it yet, so I can’t really say, but you might want to check it out. JSON.NET is a great tool and it already handles Dictionaries well, unless your keys are classes (as opposed to structs). Say you have the following class you want to serialize: public class DataPoints { public IDictionary<DataPointKey, int> Values { get; set; }

JSON.NET can handle serializing and deserializing private fields, but you have to tell it to do so. In the past, you had to set the DefaultMembersSearchFlags property of the ContractResolver of your settings. But this property is now marked obsolete. The documentation/Intellisense tells you to override GetSerializableMembers instead. But I’ve found there’s just one extra step involved. First thing to do is to create your own class that inherits from DefaultContractResolver and override the GetSerializableMembers method: protected override List<MemberInfo> GetSerializableMembers(Type