title: Jenkins Bitbucket Plugin - Cannot parse POST data
body: <p>Sending a POST request to <code>/jenkins/bitbucket-hook</code> causes a 500 error:</p>
  
  <p><code>javax.servlet.ServletException: net.sf.json.JSONException: A JSONObject text must begin with '{' at character 0 of</code></p>
  
  <p>Regardless of the content type, or body data.
  The body data being sent is that outlined by Bitbucket:</p>
  
  <pre><code>{
      "canon_url": "https://bitbucket.org",
      "commits": [
          {
              "author": "marcus",
              "branch": "master",
              "files": [
                  {
                      "file": "somefile.py",
                      "type": "modified"
                  }
              ],
              "message": "Added some more things to somefile.py\n",
              "node": "620ade18607a",
              "parents": [
                  "702c70160afc"
              ],
              "raw_author": "Marcus Bertrand &lt;marcus@somedomain.com&gt;",
              "raw_node": "620ade18607ac42d872b568bb92acaa9a28620e9",
              "revision": null,
              "size": -1,
              "timestamp": "2012-05-30 05:58:56",
              "utctimestamp": "2012-05-30 03:58:56+00:00"
          }
      ],
      "repository": {
          "absolute_url": "/marcus/project-x/",
          "fork": false,
          "is_private": true,
          "name": "Project X",
          "owner": "marcus",
          "scm": "git",
          "slug": "project-x",
          "website": "https://atlassian.com/"
      },
      "user": "marcus"
  }
  </code></pre>
  
  <p>Jenkins is the most up to date version, along with the Bitbucket plugin.</p>
  
  <p>Update: I have used the data directly taken from BitBucket.
  <a href="http://www.posttestserver.com/data/2015/05/20/sb/02.50.32555038623">http://www.posttestserver.com/data/2015/05/20/sb/02.50.32555038623</a></p>