title: How can i send the json array to server with json?
body: <p>I'm beginner in android,i have this data on the my sqlite database:<br/>
  <a href="https://i.stack.imgur.com/wUH3n.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wUH3n.png" alt="enter image description here"></a></p>
  
  <p><br/>
  now i want send the one row of that table:<br/>
  i create this class:<br/></p>
  
  <pre><code>public class TourMyCountry {
          String NAME;
          String FAMILY;
          String ID;
  
  
      }
  </code></pre>
  
  <p><br/>
  and in android button click event write this code:<br/></p>
  
  <pre><code>new HttpAsyncTask().execute("http://myHOST.ir/getLIST.aspx");
  </code></pre>
  
  <p><br/>
  and write this code:<br/></p>
  
  <pre><code>private class HttpAsyncTask extends AsyncTask&lt;String, Void, String&gt; {
          @Override
          protected String doInBackground(String... urls) {
              TourMyCountry country = new TourMyCountry();
  
              country.ID =//READ DATA FROM SQLITE
              country.NAME=//READ DATA FROM SQLITE
              country.FAMILY=//READ DATA FROM SQLITE
  
              return POST(urls[0], country);
          }
  @Override
          protected void onPostExecute(String result) {
  
          }
  
      }
  //-----------------------
  //**************************************POST LEVEL
      public static String POST(String url, TourMyCountry myCountry) {
          InputStream inputStream = null;
          String result = "";
          try {
              // 1. create HttpClient
              HttpClient httpclient = new DefaultHttpClient();
              // 2. make POST request to the given URL
              HttpPost httpPost = new HttpPost(url);
              String json = "";
              // 3. build jsonObject
              JSONObject jsonObject = new JSONObject();
              jsonObject.accumulate("id", myCountry.id);
              jsonObject.accumulate("name", myCountry.NAME);
              jsonObject.accumulate("family", myCountry.FAMILY);
  
              json = jsonObject.toString();
              StringEntity se = new StringEntity(json);
              json = jsonObject.toString();
              httpPost.setEntity(new StringEntity(json.toString(),"UTF-8"));
              httpPost.setHeader("Accept", "application/json");
              httpPost.setHeader("Content-type", "application/json");
              HttpResponse httpResponse = httpclient.execute(httpPost);
             inputStream = httpResponse.getEntity().getContent();
              if (inputStream != null)
                  result = convertInputStreamToString(inputStream);
              else
                  result = "Did not work!";
  
          }//end of try
          catch (Exception e) {
              Log.d("InputStream", e.getLocalizedMessage());
          }//end of catch
  
          // 11. return result
          return result;
      }//end of POST method
  //-----------------------------
  private static String convertInputStreamToString(InputStream inputStream) throws IOException {
          BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
          String line = "";
          String result = "";
          while ((line = bufferedReader.readLine()) != null)
              result += line;
  
          inputStream.close();
          return result;
      }
  </code></pre>
  
  <p><br/>
  up code just send one row,and work very good,but i want send all data of up table,how can i solve that?can i create array of json or other way?thanks for help me.</p>