Finally fixed POSTing of JSON data to server