title: Add dynamic elements to an already existing model in .NET mvc
body: <p>I'm building a dashboard (in a .NET MVC project) that basically receives data through an api and displays it in a (somewhat) fancy view.</p>
  
  <p>The data I receive is formatted in json and I know the format of the "root" (not sure if this is the correct term when talking about json, feel free to correct me) which is something along those lines :</p>
  
  <pre><code>{
  response : 
    {
    fields :
      [{
        name : name1,
       },
       {
        name : name2,
       },
       ...
      ],
    results :
      [{
        name1 : value1,
        name2 : value2
       },
       {
        name1 : value3,
        name2 : value4
       },
       ...
      ]
    }
  }
  </code></pre>
  
  <p>As you can see, the array 'results' varies from one response to the next, with the names 'name1' and 'name2' being user-generated (i.e. unpredictable). Now I can deserialize the json to extract the 'fields' array and its values using this model :</p>
  
  <pre><code>namespace WebApplication1.Models
  {
      public class Field
      {
          public string name { get; set; }
      }
  
      public class Result
      {
      }
      public class JsonResponse
      {
          public List&lt;Field&gt; fields { get; set; }
          public List&lt;Result&gt; results { get; set; }
      }
  }
  </code></pre>
  
  <p>My problem is :</p>
  
  <p>when I pass this to the view, the 'results' array is filled with empty 'Objects' (which feels normal as they are not described in the model)</p>
  
  <pre><code>results: Array(5)
  0: {}
  1: {}
  2: {}
  3: {}
  4: {}
  </code></pre>
  
  <p>My goal is :</p>
  
  <p>I want to be able to add the correct description of 'results' to the model (that I can get from the 'fields' array) before passing it to the view, so that all the data is available in the view.</p>
  
  <p>Things that have tried :</p>
  
  <ol>
  <li><p>sending the Json as a string to the view and parse it with JavaScript but that doesn't work since we use a model-dependant engine to display our data</p></li>
  <li><p>using a dynamicObj to decode the json, but I couldn't pass it to the view (as it is not a model)</p></li>
  <li><p>crying, but it (surprinsingly) didn't work either.</p></li>
  <li><p>probably some other thing I'm forgetting at this time.</p></li>
  </ol>
  
  <p>I have been scouring the web for days for a solution, and I'm getting desperate, any ideas are welcome.</p>
  
  <p>Thank you !</p>