title: Fetch data from local json file and display in html asp.net mvc
body: <p>I need to fetch data from json file that file is located in my computer, I pasted my code below but I get an error:</p>
  <blockquote>
  <p>Newtonsoft.Json.JsonReaderException: 'Unexpected character encountered while parsing value: h. Path '', line 0, position 0.'</p>
  </blockquote>
  <p>Can anyone give me a solution for this? Thanks in advance :)</p>
  <p>Model class jsondata.cs</p>
  <pre><code>namespace fetch_data_jsonfile.Models
  {
      public class jsondata
      {
          public string id { get; set; }
          public string title { get; set; }
          public string price { get; set; }
          public string description { get; set; }
          public string category { get; set; }
          public string image { get; set; }
  
      }
  
      public class Products
      {
          public IList&lt;jsondata&gt; products;
      }
  } 
  </code></pre>
  <p>Controller:</p>
  <pre><code>namespace fetch_data_jsonfile.Controllers
  {
      public class JsonfileController : Controller
      {
          [HttpGet]
          public ActionResult Home()
          {
              // Example JSON
              var json = &quot;D:/Newfolder/products.json&quot;;
              var Products = JsonConvert.DeserializeObject&lt;Products&gt;(json);
              return View(Products);
          }
      }
  }
  </code></pre>
  <p>View: Home.cshtml</p>
  <pre><code>@{
      Layout = null;
  }
  
  &lt;!DOCTYPE html&gt;
  &lt;!-- template from http://getbootstrap.com/getting-started --&gt;
  
  &lt;html lang=&quot;en&quot;&gt;
  &lt;head&gt;
      &lt;meta charset=&quot;utf-8&quot;&gt;
      &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;
      &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;
      &lt;title&gt;json&lt;/title&gt;
  
      &lt;!-- CSS Includes --&gt;
      &lt;link rel=&quot;stylesheet&quot; href=&quot;//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css&quot;&gt;
  
      &lt;style type=&quot;text/css&quot;&gt;
  
          .field-validation-error {
              color: #ff0000;
          }
      &lt;/style&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;div class=&quot;container&quot;&gt;
          &lt;div class=&quot;col-md-6 col-md-offset-3&quot;&gt;
              &lt;ul&gt;
                  @foreach (var jsondata in Model.Products)
                  {
                      &lt;li&gt;@jsondata.title&lt;/li&gt;
                  }
              &lt;/ul&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>json file data</p>
  <pre><code>{ &quot;products&quot; : [{
  &quot;id&quot;:1,
  &quot;title&quot;:&quot;Fjallraven - Foldsack No. 1 Backpack, Fits 15 Laptops&quot;,
  &quot;price&quot;:109.95,
  &quot;description&quot;:&quot;Your perfect pack for everyday use and walks in the forest. Stash your laptop (up to 15 inches) in the padded sleeve, your everyday&quot;,
  &quot;category&quot;:&quot;men's clothing&quot;,
  &quot;image&quot;:&quot;https://fakestoreapi.com/img/81fPKd-2AYL._AC_SL1500_.jpg&quot;,
  &quot;rating&quot;:{&quot;rate&quot;:3.9,&quot;count&quot;:120}},
  ]}
  
  </code></pre>