title: Unhandled exception type JSONException
body: <pre><code>JSONObject login = new JSONObject();
  login.put("Key1", "Value1");
  </code></pre>
  
  <p>I was just trying to create a simple JSON Object with key and value pairs. I get this exception "<code>Unhandled exception type JSONException</code>". </p>
  
  <pre><code>Map&lt;String,String&gt; map = new HashMap&lt;String,String&gt;
  map.put("key1", "value1");
  </code></pre>
  
  <p>Are they both equivalent way of creating an object with key, value pair. Which is the preferred way when creating an object which needs to send to a service.</p>