title: How to convert HashMap to json Array in android?
body: <p>I want to <strong>convert <a href="https://docs.oracle.com/javase/7/docs/api/java/util/HashMap.html" rel="noreferrer">HashMap</a> to <a href="https://www.w3schools.com/js/js_json_arrays.asp" rel="noreferrer">json array</a></strong> my code is as follow:</p>
  
  <pre><code>Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
  
  map.put("first", "First Value");
  
  map.put("second", "Second Value");
  </code></pre>
  
  <p><strong>I have tried this but it didn't work</strong>. Any solution?</p>
  
  <pre><code>JSONArray mJSONArray = new JSONArray(Arrays.asList(map));
  </code></pre>