Send a JSON object in POST instead of CGI form data

With this change, the request body sent to the server is actually a proper JSON object instead of a flat list of CGI variables with nested names.

Further encoding the URL and HTML becomes unnecessary as a bonus.