Encode POST request in json