Linked Questions

214 votes
9 answers
293k views

I am developing an API to expose some data using ASP.NET Web API. In one of the API, the client wants us to expose the date in yyyy-MM-dd format. I don't want to change the global settings (e.g. ...
Stay Foolish's user avatar
  • 3,776
209 votes
8 answers
179k views

I am very confused about the DataContract attribute in WCF. As per my knowledge it is used for serializating user defined type like classes. I wrote one class which is exposed at client side like this....
sam's user avatar
  • 2,099
124 votes
6 answers
182k views

json serializer settings for legacy asp.net core applications were set by adding AddMvc().AddJsonOptions(), but I don't use AddMvc() in asp.net core 3. So how can I set global json serialization ...
Alex Zaitsev's user avatar
  • 2,786
92 votes
6 answers
233k views

Is it possible to serialize a .Net Dictionary<Key,Value> into JSON with DataContractJsonSerializer that is of the format: { key0:value0, key1:value1, ... } I use Dictionary <K,V>, ...
Aaaaaaaa's user avatar
  • 2,114
46 votes
3 answers
29k views

I'm using Json.Net for serialization. I have a class with a Dictionary: public class Test { public string X { get; set; } public Dictionary<string, string> Y { get; set; } } Can I ...
Nataly's user avatar
  • 563
34 votes
5 answers
14k views

Here's my dilemma. I'm using a RESTful ASP.NET service, trying to get a function to return a JSON string in this format: {"Test1Key":"Test1Value","Test2Key":"Test2Value","Test3Key":"Test3Value"} But ...
Katherine Williams's user avatar
26 votes
1 answer
21k views

Is there a way/library that will allow me to customize JSON serialization similar to GSON custom serializers? Here is what I'm trying to get: this object: KeyValuePair("Age",10) myAge will normally ...
abolotnov's user avatar
  • 4,350
12 votes
2 answers
15k views

Is it possible to replace the default JSON serialization of WCF (I'm currently testing with the webHttp behaviour), and passing application/json as the MIME type. In particular, I don't like that by ...
jaraics's user avatar
  • 4,349
8 votes
2 answers
11k views

I'm still a newbie with wcf and not too well informed in .net in general. I have a WCF 4 web service that uses the global.asax routing approach and very simplified web.config using the standard ...
Jeff Maier's user avatar
9 votes
1 answer
5k views

I have an [DataContract] object that has some properties and is serialized to JSON using DataContractJsonSerializer. One of the properties is of type Dictionary<string, string> and when the ...
xplat's user avatar
  • 8,666
5 votes
1 answer
1k views

Let's say I've got a custom type that looks like this: [DataContract] public class CompositeType { [DataMember] public bool HasPaid { get; set; } [DataMember] ...
snark's user avatar
  • 2,937
1 vote
1 answer
2k views

I have a service that has a method like this [ServiceContract(Namespace = "")] [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class ...
bogdanbrudiu's user avatar
2 votes
1 answer
471 views

I would like to deserialize a JSON dictionary I receive from a python application via HTTP into a Dictionary in C#. The JSON object looks like this: { "native_dict": { "foo": 0, "...
Corbie's user avatar
  • 1,144
0 votes
0 answers
100 views

I have created a WCF service that accepts, for example, this json: { "type": "despatch", "client_ref": "ORD00001", "date_despatched": "2015-...
kbbucks's user avatar
  • 148