title: Create JSONObject from POJO
body: <p>I created a simple POJO:</p>
  
  <pre><code>public class LoginPojo {
      private String login_request = null;
      private String email = null;
      private String password = null;
  
      // getters, setters
  }
  </code></pre>
  
  <p>After some searching I found this: <a href="https://stackoverflow.com/questions/9593409/convert-pojo-to-json"><code>JSONObject jsonObj = new JSONObject( loginPojo );</code></a></p>
  
  <p>But with this I got the error: </p>
  
  <pre><code>The constructor JSONObject(LoginPojo) is undefined
  </code></pre>
  
  <p>I found another solution:</p>
  
  <pre><code>JSONObject loginJson = new JSONObject();
  loginJson.append(loginPojo);
  </code></pre>
  
  <p>But this method does not exist.</p>
  
  <p>So how can I convert my POJO into a JSON?</p>