title: WebServices Consumes JSON data with Silverlight 5
body: <p>First of all, I'm using the View-ModelsViews-Model and I'm new to Silverlight.</p>
  
  <p>I would like to get JSON Data from an other application on Internet and display it into a grid.</p>
  
  <p>On the ViewModelPage I have this : </p>
  
  <pre><code>    public void SetBasicAuthHeader(WebRequest req, String userName, String userPassword)
      {
          string authInfo = userName + ":" + userPassword;
          authInfo = Convert.ToBase64String(Encoding.Default.GetBytes(authInfo));
          req.Headers["Authorization"] = "Basic " + authInfo;
      }
  
      public void Request()
      {
          // create the http request
          HttpWebRequest httpWebRequest = WebRequest.CreateHttp("Myurl");
          httpWebRequest.Method = "GET";
          httpWebRequest.Accept = "application/json";
          SetBasicAuthHeader(httpWebRequest, "mylogin", "mypassword");
  
  
          // get the response asynchronously
          httpWebRequest.BeginGetResponse(OnGetResponseCompleted, httpWebRequest);
      }
  
      public void OnGetResponseCompleted(IAsyncResult ar)
      {
          var httpWebRequest = (HttpWebRequest)ar.AsyncState;
  
          // get the response
          var response = httpWebRequest.EndGetResponse(ar);
  
          // deserialize json
          var jsonSerializer = new DataContractJsonSerializer(typeof(Users));
          var responseObject = (ListUtilisateursRest)jsonSerializer.ReadObject(response.GetResponseStream());
  
          // display on the view
          Deployment.Current.Dispatcher.BeginInvoke();
      }
  </code></pre>
  
  <p>I have also created a Portable Library with this : </p>
  
  <pre><code>[DataContract]
  public class Users
  {
      [DataMember(Name = "Users")]
      private List&lt;String&gt; UsersList = new List&lt;String&gt;();
  }
  </code></pre>
  
  <p>I know i have to put something into the "BeginInvoke" to bind the data to the views, but I have no idea how to do that, Could you help me ?</p>
  
  <p>Thanks,</p>