title: Unable to deserialize json array using wcf service
body: <p>I'm trying to DeSerialize data in json array using wcf service in the project. 
  The data is fetched and can be noticed in the debugging but i'm unable to deserialize, or something else that I'm mistaken. Below is the code that I've tried to deserialize. 
  <strong>Note:-</strong> I've separately run the wcf application and its returning json array in correct format with the actual result.</p>
  
  <p><strong>HotelServiceClient.cs</strong></p>
  
  <pre><code>public class HotelServiceClient
      {
          private string BASE_URL = "http://localhost:50540/ServiceHotel.svc/";
  
          public List&lt;HotelInfo&gt; findall()
          {
              try
              {
                  var webClient = new WebClient();
                  var json = webClient.DownloadString(BASE_URL + "findall");
                  var javaScriptJson = new JavaScriptSerializer();
                  return javaScriptJson.Deserialize&lt;List&lt;HotelInfo&gt;&gt;(json);
  
              }
              catch
              {
                  return null;
              }
          }
  </code></pre>
  
  <p><strong>HotelInfo.cs</strong></p>
  
  <pre><code>public class HotelInfo
      {
          private int _hotelid;
          private string _hotelname;
          private string _hoteldesc;
          private string _hotelprice;
          private byte[] _hotelpicture;
  
  
          [Key]
          [Display(Name = "Id")]
          public int Hotelid
          {
              get
              {
                  return _hotelid;
              }
  
              set
              {
                  _hotelid = value;
              }
          }
  
          [Display(Name = "Name")]
          public string Hotelname
          {
              get
              {
                  return _hotelname;
              }
  
              set
              {
                  _hotelname = value;
              }
          }
  
          [Display(Name = "description")]
          public string Hoteldesc
          {
              get
              {
                  return _hoteldesc;
              }
  
              set
              {
                  _hoteldesc = value;
              }
          }
  
          [Display(Name = "price")]
          public string Hotelprice
          {
              get
              {
                  return _hotelprice;
              }
  
              set
              {
                  _hotelprice = value;
              }
          }
  
          [Display(Name = "picture")]
          public byte[] Hotelpicture
          {
              get
              {
                  return _hotelpicture;
              }
  
              set
              {
                  _hotelpicture = value;
              }
          }
  
  
      }
  </code></pre>
  
  <p><strong>WebService</strong></p>
  
  <p><strong>Hotel.cs</strong></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  
  namespace CRUDwithHotels
  {
      public class Hotel
      {
          public int Id { get; set; }
          public string Name { get; set; }
          public string description { get; set; }
          public string price { get; set; }
          public byte[] picture { get; set; }
  
      }
  }
  </code></pre>
  
  <p><strong>IServiceHotel.cs</strong></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Runtime.Serialization;
  using System.ServiceModel;
  using System.ServiceModel.Web;
  using System.Text;
  
  namespace CRUDwithHotels
  {
      // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IServiceHotel" in both code and config file together.
      [ServiceContract]
      public interface IServiceHotel
      {
  
          [OperationContract]
          [WebInvoke(Method ="GET", UriTemplate ="findall", ResponseFormat =WebMessageFormat.Json)]
          List&lt;Hotel&gt; findall();
  
          [OperationContract]
          [WebInvoke(Method = "GET", UriTemplate = "find/{id}", ResponseFormat = WebMessageFormat.Json)]
          Hotel find(string id);
  
          [OperationContract]
          [WebInvoke(Method = "POST", UriTemplate = "create", ResponseFormat = WebMessageFormat.Json, RequestFormat =WebMessageFormat.Json)]
          bool create(Hotel hotel);
  
          [OperationContract]
          [WebInvoke(Method = "PUT", UriTemplate = "edit", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
          bool edit(Hotel hotel);
  
          [OperationContract]
          [WebInvoke(Method = "DELETE", UriTemplate = "delete", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
          bool delete(Hotel hotel);
  
  
  
      }
  }
  </code></pre>
  
  <p><strong>ServiceHotel.svc.cs</strong></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Runtime.Serialization;
  using System.ServiceModel;
  using System.Text;
  
  namespace CRUDwithHotels
  {
      // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "ServiceHotel" in code, svc and config file together.
      // NOTE: In order to launch WCF Test Client for testing this service, please select ServiceHotel.svc or ServiceHotel.svc.cs at the Solution Explorer and start debugging.
      public class ServiceHotel : IServiceHotel
      {
          public bool create(Hotel hotel)
          {
              using (ModelMyDemo hie = new ModelMyDemo())
              {
                  try
                  {
                      HotelInfoEntities info = new HotelInfoEntities();
                      info.Hotelname = hotel.Name;
                      info.Hoteldesc = hotel.description;
                      info.Hotelprice = hotel.price;
                      info.Hotelpicture = hotel.picture;
                      hie.HotelInfoEntities.Add(info);
                      hie.SaveChanges();
                      return true;
                  }
                  catch
                  {
                      return false;
                  }
              };
          }
  
          public bool delete(Hotel hotel)
          {
              using (ModelMyDemo hie = new ModelMyDemo())
              {
                  try
                  {
                      int id = Convert.ToInt16(hotel.Id);
                      HotelInfoEntities info = hie.HotelInfoEntities.Single(p =&gt; p.Hotelid == id);
                      hie.HotelInfoEntities.Remove(info);
                      hie.SaveChanges();
                      return true;
                  }
                  catch
                  {
                      return false;
                  }
              };
          }
  
  
  
          public bool edit(Hotel hotel)
          {
              using (ModelMyDemo hie = new ModelMyDemo())
              {
                  try
                  {
                      int id = Convert.ToInt16(hotel.Id);
                      HotelInfoEntities info = hie.HotelInfoEntities.Single(p =&gt; p.Hotelid == id);
                      info.Hotelname = hotel.Name;
                      info.Hoteldesc = hotel.description;
                      info.Hotelprice = hotel.price;
                      info.Hotelpicture = hotel.picture;
                      hie.SaveChanges();
                      return true;
                  }
                  catch
                  {
                      return false;
                  }
              };
          }
  
          public Hotel find(string id)
          {
              int hid = Convert.ToInt16(id);
              using (ModelMyDemo hie = new ModelMyDemo())
              {
                  return hie.HotelInfoEntities.Where(pe =&gt; pe.Hotelid == hid).Select(pe =&gt; new Hotel
                  {
                      Id = pe.Hotelid,
                      Name = pe.Hotelname,
                      description = pe.Hoteldesc,
                      price = pe.Hotelprice,
                      picture = pe.Hotelpicture
  
                  }).First();
              };
  
          }
  
          public List&lt;Hotel&gt; findall()
          {
  
              //var imagesrc = string.Format("data:image/jpeg;base64,{0}", base64);
              using (ModelMyDemo hie = new ModelMyDemo())
              {
                  return hie.HotelInfoEntities.Select(pe =&gt; new Hotel
                  {
                      Id = pe.Hotelid,
                      Name = pe.Hotelname,
                      description = pe.Hoteldesc,
                      price = pe.Hotelprice,
                      picture = pe.Hotelpicture
  
  
                 // picture = pe.Hotelpicture
                  }).ToList();
              };
          }
      }
  }
  </code></pre>