title: Parse data to JSON using hash maps
body: <p>I'm trying to convert the hexmaps into useable json code but I don't know really know how</p>
  
  <pre><code>protected Map&lt;String, String&gt; getParams() {
      Map&lt;String, String&gt;  params = new HashMap&lt;String, String&gt;();
      params.put("user_id", userID );
      Map&lt;String, String&gt;  foodOrder = new HashMap&lt;String, String&gt;();
      foodOrder.put("id",productID);
  
      foodOrder.put("item_count",numberOfItems.getText().toString());
  
      params.put("product", foodOrder.toString());
      Arrays.deepToString(new JSONObject[]{new JSONObject(params)});
  
      return params;
  }
  </code></pre>
  
  <p>It should look something like this:</p>
  
  <pre><code>{
    "user_id": 2,
    "product": {
        "id": 15,
        "item_count": 99
    }
  }
  </code></pre>
  
  <p>But now I get this:</p>
  
  <pre><code>{
    "product": "{item_count=1, id=1}", 
    "user_id": "2"
  }
  </code></pre>
  
  <p>I'm using the Volly library to pass the data form app to server.</p>