POST multiple parameters to an ASP .NET Web Api REST service from a .NET 3.5 assembly, by using one dynamic JObject "options" parameter.

  Client code in .NET 3.5   namespace WordMerge.EndToEndTests { using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Net; using Newtonsoft.Json; [TestClass] public class UnitTest1 { [TestMethod] public void Execute_a_post_request() { string url = "http://localhost:63544/api/document"; object result = string.Empty; // Uses the System.Net.WebClient and not HttpClient, because .NET 2.0 must be supported. using …

JSON Serialization and Deserialization

Found a good articale on JSON Serialization and Deserialization: http://www.codeproject.com/Articles/272335/JSON-Serialization-and-Deserialization-in-ASP-NET I used this article to create a class that serializes DataSet, DataTable and DataRow objects: I just changed one aspect of the codeproject article, I used the regular expression "\\/Date\((-?\d+)\)\\/" instead of  “\\/Date\((\d+)\+\d+\)\\/”. The regular expression “\\/Date\((-?\d+)\)\\/” takes into account …

Dump all object properties to a string by using JSON in C#

If you want to dump the properties of an object into a string (lets say for logging purposes), you can use JSON serialization in C#. The output string is far less bulky than using XML serialization. using System.Collections.Generic; using System.Web.Script.Serialization; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace NewCode.Rli { [TestClass] public class NewCodeTester { …