title: Pass JSON object in GET request: iOS
body: <p>I want to add the <code>JSON</code> object in GET request with <code>URL</code>. Please refer below URL.</p>
  
  <pre><code>https://testdata.com/xyz/&amp;form={"id":"12", "data": "3"}
  </code></pre>
  
  <p>I am getting <code>nil</code> while converting <code>String</code> to <code>URL</code></p>
  
  <pre><code>let serviceUrl = URL(string: url) 
  </code></pre>
  
  <p>Thanks in advance.</p>
  
  <p>I was already tried below solution but unfortunately no luck.</p>
  
  <ul>
  <li>JSONSerialization.data</li>
  <li>converting to string with utf8</li>
  <li>removed whitespaces if any</li>
  <li>addingPercentEncoding with URL host allowed</li>
  </ul>