title: How to send an Object as JSON to a Server using NameValuePairs?
body: <p>I am attempting to add some <code>Book(title, author, year)</code> into my <code>book</code> table in a server using an <code>AsyncTask</code>, but i am getting <code>missing bookobject as JSON</code>from the method <code>addBook</code>(from the server). So i made a <code>bookObject</code> like this:</p>
  
  <pre><code>JSONObject jObj = new JSONObject();
  jObj.put("title", "JAVA");
  jObj.put("author", "me");
  jObj.put("year", 2005);
  </code></pre>
  
  <p>After that, i wanna use(my intention is to send this book <code>Object</code>):</p>
  
  <pre><code>List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;&gt;(1);
  nameValuePairs.add(new BasicNameValuePair(jObj));        //Error
  new AaaBookAsyncTask(this).execute(new Pair&lt;&gt;(nameValuePairs, httpClient));
  </code></pre>
  
  <p>The problem is <code>BasicNameValuePair</code>cannot applied to <code>JSONObject</code>, but now how can i send the book <code>Object</code>? - Any help or hints is very appreciated.Thanks, Carl</p>