Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"application/json" constant in .NET framework

I've just declared a constant for the "application/json" content type in one of my classes.

public const string JsonContentType = "application/json"; 

I'm not sure it is a good practice.

Does .NET framework have a predefined const for "application/json"?

like image 596
Maxim Eliseev Avatar asked Dec 18 '13 10:12

Maxim Eliseev


1 Answers

In order to add an up-to-date answer: since dotnet core 2.1 MediaTypeNames.Application.Json has been defined.

See https://github.com/dotnet/corefx/pull/26701 for the changeset.

like image 118
Bob Van de Vijver Avatar answered Sep 19 '22 14:09

Bob Van de Vijver