79416246

Date: 2025-02-05 21:35:56
Score: 1.5
Natty:
Report link

This worked for me (.NET Framework 4.8.1) VS 2022 C# The JSON or any serializer object need to be generated with not to include typeinformation settings. Below is an example:

var settings = new DataContractJsonSerializerSettings();
settings.EmitTypeInformation = EmitTypeInformation.Never;

var serializer = new DataContractJsonSerializer(yourType, settings);

or

var serializer = new DataContractJsonSerializer(yourType, new DataContractJsonSerializerSettings() {EmitTypeInformation=EmitTypeInformation.Never});

Thanks to: Daniel https://stackoverflow.com/users/572644/daniel-hilgarth in

How do I tell DataContractJsonSerializer to not include the "__type" property

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Blacklisted phrase (1): How do I
  • Blacklisted phrase (1): stackoverflow
  • Whitelisted phrase (-1): This worked for me
  • Whitelisted phrase (-1): worked for me
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Dr. Venkata Goli