Convert a class to a Json Object in c#

I have a class DraftForm :

public class DraftForm 
    public string Json { get; set; }
    public System.DateTime CreatedDate { get; set; }
    public string DraftNumber { get; set; }
    public string DraftName{ get; set; }

In this method I want to return a Json of the DraftForm class :

public Object GetAllDraftDossier()
    var draftDossiers = _context.DraftForms
        .Where(x=> x.DraftName== "Repairer")
    var json = Newtonsoft.Json.JsonConvert.SerializeObject(
        new JsonSerializerSettings { 
            ContractResolver = new CamelCasePropertyNamesContractResolver()
    return json;

In postman it returns a string and not a json ! Can anyone help me ?

Read more here:

Content Attribution

This content was originally published by hiba nebli at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: