JsonConvert.SerializeObject escaping backslash
<p>I've been reading loads of questions about this issue but can't seem to resolve my particular issue.</p>

<p>I'm returning a json string from a web service function.</p>

<p>I have these objects:</p>

<pre><code>public class WebServiceInitResult
{
    public List&lt;Activity&gt; Activities { get; set; }
    //rest of properties left out...
}

public class Activity
{
    public string IconCode { get; set; }
    //rest of properties left out...
}
</code></pre>

<p>The <code>IconCode</code> is the character code for a fontawesome character, any one of these:</p>

<pre><code>\uf0b1
\uf274
\uf185
\uf0fa
\uf0f4
\uf015
</code></pre>

<p>They are stored in a database exactly as shown above.</p>

<p>When I set the <code>httpReponse.Content</code> like below, the backslash is escaped:</p>

<pre><code>httpResponseMessage.Content = new StringContent(JsonConvert.SerializeObject(webServiceInitResult), Encoding.UTF8, "application/json");
</code></pre>

<p>The json response received by PostMan is:</p>

<pre><code>"activities": [
{
  "ActivityCode": 2,
  "DisplayValue": "Shopping",
  "BackgroundColour": "E74C3C",
  "IconCode": "\\uf0b1",
  "ApplicationId": 2,
  "Application": null,
  "Id": 1,
  "Active": true,
  "DateCreated": "2016-11-25T10:15:40"
},
//rest of activities
]
</code></pre>

<p>As you can see, the <code>IconCode</code> backslash has been escaped. From reading other questions, I'm unable to confidently decide if this is happening by Json.NET when I serialize or when then response is sent.</p>

<p>I tried to resolve using <code>ObjectContent</code> instead so I could avoid Json.NET but it returned the same!</p>

<pre><code>httpResponseMessage.Content = new ObjectContent(typeof(TravelTrackerWebServiceInitResult), webServiceInitResult, new JsonMediaTypeFormatter() , "application/json");
</code></pre>

<p>Now I am stuck!</p>

<p>Is there a better way to do this that will return exactly what I need? The characters are used by an app to display the appropriate icon.</p>

<p>Extra info:
I originally had these values hardcoded and everything seemed to work ok:</p>

<pre><code>webServiceInitResult.activities_TT = new List&lt;Activity_TT&gt;()
{
 new Activity() { ActivityCode = 2, BackgroundColour = "E74C3C", DisplayValue="Shopping", IconCode="\uf0b1" },
 new Activity() { ActivityCode = 3, BackgroundColour = "BF7AC5", DisplayValue="Running", IconCode="\uf274" },
 new Activity() { ActivityCode = 4, BackgroundColour = "AF7AC5", DisplayValue="Walking", IconCode="\uf185" },
 new Activity() { ActivityCode = 5, BackgroundColour = "3498DB", DisplayValue="Jogging", IconCode="\uf0fa"  },
 new Activity() { ActivityCode = 6, BackgroundColour = "2ECC71", DisplayValue="Resting", IconCode="\uf0f4" },
 new Activity() { ActivityCode = 7, BackgroundColour = "F39C12", DisplayValue="Skipping", IconCode="\uf015" }
};
</code></pre>

<p>Thanks.</p>