title: How to load data in dataGrid direct from raw Json data from url in C#?
body: <pre><code>&lt;ListView x:Name="listView" Height="150" Canvas.Left="10" Canvas.Top="60" Width="402"&gt;
      &lt;ListView.View&gt;
          &lt;GridView&gt;
              &lt;GridViewColumn Header="Product ID" DisplayMemberBinding="{Binding productId}"/&gt;
              &lt;GridViewColumn Header="Product Name" DisplayMemberBinding="{Binding productName}"/&gt;
              &lt;GridViewColumn Header="Unit Price" DisplayMemberBinding="{Binding unitPrice}"/&gt;
              &lt;GridViewColumn Header="Units in stock" DisplayMemberBinding="{Binding unitsInStock}"/&gt;
              &lt;GridViewColumn Header="Reorder Level" DisplayMemberBinding="{Binding reorderLevel}"/&gt;
  
          &lt;/GridView&gt;
      &lt;/ListView.View&gt;
  &lt;/ListView&gt;
  
  &lt;DataGrid x:Name="dataGrid" Canvas.Left="10" Canvas.Top="215" AutoGenerateColumns="False" Height="178" Width="402"
      HorizontalAlignment="Stretch" 
        VerticalAlignment="Stretch" 
        ItemsSource="{Binding Items}"&gt;
      &lt;DataGrid.Columns&gt;
          &lt;DataGridTextColumn Header="productId" Binding="{Binding Path=productId}"/&gt;
          &lt;DataGridTextColumn Header="productName" Binding="{Binding Path=productName}"/&gt;
          &lt;DataGridTextColumn Header="unitPrice" Binding="{Binding Path=unitPrice}"/&gt;
          &lt;DataGridTextColumn Header="unitsInStock" Binding="{Binding Path=unitsInStock}"/&gt;
          &lt;DataGridTextColumn Header="reorderLevel" Binding="{Binding Path=reorderLevel}"/&gt;
      &lt;/DataGrid.Columns&gt;
  &lt;/DataGrid&gt;
  </code></pre>
  
  <p>Above are two WPF controls, listBox and dataGrid. I am able to directly load into listBox from raw Json data from a URL. I want to do same for dataGrid. I want to load data into dataGrid from raw Json data. Please help.</p>
  
  <p>Product class contains 5 attributes.</p>
  
  <p>Backend ::</p>
  
  <pre><code>private void TestConnection(object sender, RoutedEventArgs e)
      {
          string url = "http://192.168.167.1:8080/StudentOnlineRetailerWeb/rest/product";
          WebClient client = new WebClient();
          string reply = client.DownloadString(url);
          DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(List&lt;Product&gt;));
          listView.Items.Clear();
          List&lt;Product&gt; product;
  
          product = (List&lt;Product&gt;)serializer.ReadObject(client.OpenRead(url));
          foreach (Product temp in product)
          {
              listView.Items.Add(temp);
          }
  
  
      }
  </code></pre>