How to fail json deserialization when unknown properties with newtonsoft

Viewed 2072

I use an external API that changes unexpectedly. In order to detect these changes, I would like the JSON deserialization (using newtonsoft json.net on ASP.NET Core) to throw an exception whenever it detects a property in the JSON that is not mapped in my POCO.

Is it possible? I tried to use the following deserialization settings but it didn't change anything:

            var serializerSettings = new JsonSerializerSettings
            {
                CheckAdditionalContent = true,
            };
0 Answers
Related