{"action":"created","issue":{"url":"https://api.github.com/repos/paulcbetts/refit/issues/161","labels_url":"https://api.github.com/repos/paulcbetts/refit/issues/161/labels{/name}","comments_url":"https://api.github.com/repos/paulcbetts/refit/issues/161/comments","events_url":"https://api.github.com/repos/paulcbetts/refit/issues/161/events","html_url":"https://github.com/paulcbetts/refit/issues/161","id":95409506,"number":161,"title":"Allow sending custom classes in multipart","user":{"login":"tamirdresher","id":342800,"avatar_url":"https://avatars.githubusercontent.com/u/342800?v=3","gravatar_id":"","url":"https://api.github.com/users/tamirdresher","html_url":"https://github.com/tamirdresher","followers_url":"https://api.github.com/users/tamirdresher/followers","following_url":"https://api.github.com/users/tamirdresher/following{/other_user}","gists_url":"https://api.github.com/users/tamirdresher/gists{/gist_id}","starred_url":"https://api.github.com/users/tamirdresher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tamirdresher/subscriptions","organizations_url":"https://api.github.com/users/tamirdresher/orgs","repos_url":"https://api.github.com/users/tamirdresher/repos","events_url":"https://api.github.com/users/tamirdresher/events{/privacy}","received_events_url":"https://api.github.com/users/tamirdresher/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-16T11:05:15Z","updated_at":"2015-07-16T13:19:40Z","closed_at":null,"body":"Currently you can only send String, Stream, FileInfo, and Byte array in a multipart request.\r\nit would be useful to allow other custom classes to be sent by converting them to JSON\r\n\r\ni think that all it takes is to add the following code at the end of the RequestBuilderImplementation.addMultipartItem(...) method\r\n\r\n```csharp\r\ntry \r\n{\r\n    var stringContent = new StringContent(JsonConvert.SerializeObject(itemValue, settings.JsonSerializerSettings), Encoding.UTF8, \"application/json\");\r\n    multiPartContent.Add(stringContent, itemName);\r\n    return;\r\n} \r\ncatch (Exception ex)\r\n{\r\n    throw new ArgumentException(string.Format(\"Unexpected parameter type in a Multipart request. Parameter {0} is of type {1}, whereas allowed types are String, Stream, FileInfo, and Byte array or a type that can be converted to json\", itemName, itemValue.GetType().Name), \"itemValue\",ex);\r\n    \r\n}\r\n```\r\n\r\nwhat do you think? i can create a pull request if it sounds good\r\n"},"comment":{"url":"https://api.github.com/repos/paulcbetts/refit/issues/comments/121953619","html_url":"https://github.com/paulcbetts/refit/issues/161#issuecomment-121953619","issue_url":"https://api.github.com/repos/paulcbetts/refit/issues/161","id":121953619,"user":{"login":"egitlits","id":13366161,"avatar_url":"https://avatars.githubusercontent.com/u/13366161?v=3","gravatar_id":"","url":"https://api.github.com/users/egitlits","html_url":"https://github.com/egitlits","followers_url":"https://api.github.com/users/egitlits/followers","following_url":"https://api.github.com/users/egitlits/following{/other_user}","gists_url":"https://api.github.com/users/egitlits/gists{/gist_id}","starred_url":"https://api.github.com/users/egitlits/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/egitlits/subscriptions","organizations_url":"https://api.github.com/users/egitlits/orgs","repos_url":"https://api.github.com/users/egitlits/repos","events_url":"https://api.github.com/users/egitlits/events{/privacy}","received_events_url":"https://api.github.com/users/egitlits/received_events","type":"User","site_admin":false},"created_at":"2015-07-16T13:19:40Z","updated_at":"2015-07-16T13:19:40Z","body":"It definitely useful!"}}