title: Android How to Pass a JSON Object as a url parameter
body: <p>I have a requirement where i have to pass a json object in a url as a paramter. Here is my url</p>
  
  <pre><code>http://test.amazonaws.com/xyx/company/12/user/1/contact/{contactActivityJSON}/key/abccedrf/contacts?op=readsave
  </code></pre>
  
  <p>Now the contactActivityJSON has the following structure</p>
  
  <pre><code>{
      "user": {},
      "event": {
          "id": 1,
      },
      "contacts": [
          {
              "id": "-1",
              "eventId": 1,
              "fields": [
                  {
                      "fieldName": "test",
                      "value": "CallMe"
                  }
              ]
          }
      ]
  }
  </code></pre>
  
  <p>Now i am having problem encoding the JSON object into the URL. I am using </p>
  
  <pre><code>ObjectMapper mapper = new ObjectMapper();
  Writer strWriter = new StringWriter();
  mapper.writeValue(strWriter, request.getRequestBody());
  String jsonString = strWriter.toString();
  String sss = URLEncoder.encode(jsonString);
  </code></pre>
  
  <p>and passing replacing this into the URL. But its not working. Can anyone please help ? </p>