(. 1) Json
the WebAPI Json default format, if the need to change the default settings Json modifications ConfigureServices method of Startup:
services.AddMvc ()
.AddJsonOptions (Options => {options.SerializerSettings.ContractResolver new new DefaultContractResolver = ();})
.SetCompatibilityVersion (CompatibilityVersion.Version_2_1);
(2)Xml
XML data format compatible WebAPI configuration (while using json and xml), was added in the Startup method ConfigureServices:
services.AddMvc () AddXmlSerializerFormatters ();.
Acquiring data, Accept request header needs to be set to text / xml or application / xml
input data, to set the request header is Content-Type text / xml or application / xml