title: Groovy - parse/ convert x-www-form-urlencoded to something like JSON
body: <p>this is my second try to explain a bit more precisely what I'm looking for ;-)</p>
  
  <p>I set a webhook in Mailchimp that fires every time a new subscriber of an audience appears. Mailchimp sends a HTTP POST request to a Jira Sriptrunner REST endpoint.</p>
  
  <p>The content type of this request is <code>application/x-www-form-urlencoded</code>.</p>
  
  <p>Within the Jira endpoint I would like to read the request data. How can I do that? </p>
  
  <p>The payload (raw body) I receive looks like this:</p>
  
  <pre><code>type=unsubscribe&amp;fired_at=2020-05-26+07%3A04%3A42&amp;data%5Baction%5D=unsub&amp;data%5Breason%5D=manual&amp;data%5Bid%5D=34f28a4516&amp;data%5Bemail%5D=examlple%40bla.com&amp;data%5Bemail_type%5D=html&amp;data%5Bip_opt%5D=xx.xxx.xxx.198&amp;data%5Bweb_id%5D=118321378&amp;data%5Bmerges%5D%5BEMAIL%5D=example%40bla.com&amp;data%5Bmerges%5D%5BFNAME%5D=Horst&amp;data%5Bmerges%5D%5BLNAME%5D=Schlemmer&amp;data%5Bmerges%5D%5BCOMPANY%5D=First&amp;data%5Bmerges%5D%5BADDRESS%5D%5Baddr1%5D=XXX
  </code></pre>
  
  <p>Now I would like to parse the data of the raw body into a JSON or something similiar. </p>
  
  <p>The result might look like this:</p>
  
  <pre><code>{
   "web_id": 123,
   "email": "example@bla.com",
   "company": "First",
   ...
   }
  </code></pre>
  
  <p>Meanwhile I searched around a little and found something like the node.js "querystring" module. It would be great if there is something similiar within Groovy or any other way to parse the data of <code>application/x-www-form-urlencoded</code> to <code>json</code> format.</p>
  
  <p>Best regards and thanks in advance</p>
  
  <p>Bernhard</p>