title: How to send a json to asp.net api Controller from android studio app?
body: <p>I wrote an app where a user has to fill some text fields with infomation 
  like name, age ... When he clicks a button the data is being send to my api controller where the put methode saves the data in a data base.</p>
  
  <p>This is kind of working exept that I don´t know how to send a json to my controller.(I researched several days but nothing worked)
  So what I do at the moment is that I write an url conform string with my data 
  so that in my controller I read out of the string what I need to know. 
  This is a very bad solution!(I can´t do spaces or slashes and so on...)</p>
  
  <p>To send my UserData I hava build an AsyncTask (When I didn´t I got an Exeption)</p>
  
  <pre><code>class SendUserTask extends AsyncTask&lt;String, Void, String&gt;{
  public AsyncResponse delegate = null;
  User user;
   @TargetApi(Build.VERSION_CODES.KITKAT)
      protected String doInBackground(String... urls) {
          try {
  
              String r = sendUser("name" + user.getName() + "street" + user.getStreet());
  
          } catch (Exception e) {
              e.printStackTrace();
          }
          return "";
      }
  
  public void setUser(User u){user = u;}
  
   public static String sendUser(String userData) throws Exception {
  
          URL url = new URL("http://my-address:port/api/users/"+ userData);
          HttpURLConnection c =(HttpURLConnection) url.openConnection();
          c.setRequestMethod("PUT");
          BufferedReader in = new BufferedReader(new InputStreamReader(
                  c.getInputStream()));
          String inputLine;
          String result = "";
          while ((inputLine = in.readLine()) != null)
              result = inputLine;
          in.close();
          return result;
      }
  
  }
  </code></pre>
  
  <p>this methode works fine when I just want to send an id or get something!</p>
  
  <p>My controller is the defalt api controller
  here is my put methode:</p>
  
  <pre><code>     public String Put(string id, [FromBody]string value){
           //stuff
          }
  </code></pre>
  
  <p>Please can anyone help!?!</p>