Using DataContractJsonSerializerSettings (available since .NET 4.5) can do this for you:
var serializer = new DataContractJsonSerializer(typeOfObj, new DataContractJsonSerializerSettings()
{
UseSimpleDictionaryFormat = true
});
More Related Contents:
- replace WCF built-in JavascriptSerializer with Newtonsoft Json.Net json serializer
- Custom WCF DataContractSerializer
- WCF Disable Deserialization Order Sensitivity
- What’s the best way to jSON serialize a .NET DataTable in WCF?
- Using Json.NET converters to deserialize properties
- What are the deficiencies of the built-in BinaryFormatter based .Net serialization?
- A reference to the dll could not be added
- How does WCF deserialization instantiate objects without calling a constructor?
- How to solve “Could not establish trust relationship for the SSL/TLS secure channel with authority”
- Injecting data to a WCF service
- How can you control .NET DataContract serialization so it uses XML attributes instead of elements?
- CryptographicException ‘Keyset does not exist’, but only through WCF
- .Net: Running code when assembly is loaded
- How do you configure WCF known types programmatically?
- Is .NET Remoting really deprecated?
- How can I ignore a property when serializing using the DataContractSerializer?
- Does .NET 4 have a built-in JSON serializer/deserializer?
- Why is the first WCF client call slow?
- ServiceRoute + WebServiceHostFactory kills WSDL generation? How to create extensionless WCF service with ?wsdl
- Generate C# classes from JSON Schema [closed]
- WCF Error “Maximum number of items that can be serialized or deserialized in an object graph is ‘65536’”
- Can I serialize Anonymous Types as xml?
- How to I serialize a large graph of .NET object into a SQL Server BLOB without creating a large buffer?
- WCF service startup error “This collection already contains an address with scheme http”
- IIS: web applications warmup
- Can I pass non-string to WCF RESTful service using UriTemplate?
- Service reference not generating client types
- WCF sessions with a wsHttpBinding and without windows security
- WCF is using the computer name instead of the IP address and cannot be resolved
- How to serialize a large graph of .NET objects into a SQL Server BLOB without creating a large buffer?