Submitted by: Srinath M S(srinath_ms@yahoo.com)

Wednesday Jan 22nd 2020 by Srinath M S
Article Image

Language: .NET, Expertise: Advanced - Learn how to get the Web API to return custom JSON.

Use StringContent in the Web API response to return a custom JSON. See below for an example:

StringContent responseContent = new StringContent ( " { 'handled' : 'true' } ", Encoding.UTF8, 'application/json');
r.Content =  responseContent;
return r;
Mobile Site | Full Site