Correctly sends JSON data to server and server pretty-prints the document