title: How do I handle a JSON request in Bottle?
body: <p>I need to get data from JSON, transferred by Ajax from the client. Basically I used something like this:</p>
  
  <pre><code>@route('/ajax')
  def serve_ajax():
      return main.parse_request(json.dumps(dict(request.GET)))
  </code></pre>
  
  <p>Where main.parse_request is a function, that contains some logics to deal with variables in JSON (it is a main procedure of our game engine).</p>
  
  <p>So the problem is that I can't correctly handle JSON variables, by transforming <code>request.GET</code> in a dict: because in a way that I already wrote I can't pass nested objects and arrays. Also every value has a string type, while I need to have integer types on integers and string type on rest other.</p>
  
  <p>Or, since I can obtain the original query string (by <code>request.query_string</code>), how can I convert a query string into an original JSON object?</p>