title: Prepare custom json format return in MVC c#
body: <p>I have two classes, namely <code>Roles</code> and <code>Module</code> in <code>Module</code> class I have two properties <code>Name</code>,<code>Permission</code>.</p>
  
  <p>for now, just testing purpose I'm creating one demo code.</p>
  
  <blockquote>
    <p>Class file</p>
  </blockquote>
  
  <pre><code>    public class Roles
      {
          public Module[] modules { get; set; }
          public Roles()
          {
              modules = new Module[] { };
          }
      }
  
      public class Module
      {
          public string Name { get; set; }
          public string[] Permission { get; set; }
      }
  </code></pre>
  
  <blockquote>
    <p>Controller code</p>
  </blockquote>
  
  <pre><code>public ActionResult Index()
  {   
      var oRoles = new Roles();
      oRoles.modules = new Module[] {
          new Module(){
              Name="Page-Profile",
              Permission=new string[]{ "Edit","View","Delete"}
          },
          new Module(){
              Name="User",
              Permission=new string[]{ "Edit","View","Delete","Update"}
          }
      };
      var json = Newtonsoft.Json.JsonConvert.SerializeObject(oRoles);
      return View(json);
  }
  </code></pre>
  
  <p>It's working fine I'm getting result also but I want result like this.</p>
  
  <blockquote>
    <p>Expected result.</p>
  </blockquote>
  
  <pre><code>{
    "modules": [
      {
        "Page-Profile": [
          "Edit",
          "View",        
          "Delete"
        ]
      },
      {
        "User": [
          "Edit",
          "View",
          "Update",
          "Delete"
        ]
      }
    ]
  }
  </code></pre>
  
  <blockquote>
    <p>Currently I'm getting a result like this. <code>is there any way to modify JSON remove all key and get only values</code>.</p>
  </blockquote>
  
  <pre><code>{
    "modules": [
      {
        "Name": "Page-Profile",
        "Permission": [
          "Edit",
          "View",
          "Delete"
        ]
      },
      {
        "Name": "User",
        "Permission": [
          "Edit",
          "View",
          "Delete",
          "Update"
        ]
      }
    ]
  }
  </code></pre>
  
  <p><strong>Note:</strong> How to remove key properties i want only name value and in name <code>value</code> again i wan't all <code>permission</code> as mention in <code>excpected result</code>.</p>