diff --git a/modules/swagger-codegen/src/main/java/com/wordnik/swagger/codegen/languages/CSharpClientCodegen.java b/modules/swagger-codegen/src/main/java/com/wordnik/swagger/codegen/languages/CSharpClientCodegen.java
index 5060899d498..9de427058a1 100644
--- a/modules/swagger-codegen/src/main/java/com/wordnik/swagger/codegen/languages/CSharpClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/com/wordnik/swagger/codegen/languages/CSharpClientCodegen.java
@@ -83,6 +83,7 @@ public CSharpClientCodegen() {
typeMapping.put("file", "string"); // path to file
typeMapping.put("array", "List");
typeMapping.put("map", "Dictionary");
+ typeMapping.put("object", "Object");
}
diff --git a/modules/swagger-codegen/src/main/resources/csharp/apiInvoker.mustache b/modules/swagger-codegen/src/main/resources/csharp/apiInvoker.mustache
index 9beebc19231..9760e44d81a 100644
--- a/modules/swagger-codegen/src/main/resources/csharp/apiInvoker.mustache
+++ b/modules/swagger-codegen/src/main/resources/csharp/apiInvoker.mustache
@@ -53,10 +53,13 @@ namespace {{invokerPackage}} {
/// JSON string
/// Object type
/// Object representation of the JSON string
- public static object Deserialize(string json, Type type) {
+ public static object Deserialize(string content, Type type) {
+ if (type.GetType() == typeof(Object))
+ return (Object)content;
+
try
{
- return JsonConvert.DeserializeObject(json, type);
+ return JsonConvert.DeserializeObject(content, type);
}
catch (IOException e) {
throw new ApiException(500, e.Message);
diff --git a/samples/client/petstore/csharp/src/main/csharp/io/swagger/client/ApiInvoker.cs b/samples/client/petstore/csharp/src/main/csharp/io/swagger/client/ApiInvoker.cs
index 144027b2314..8bb36472835 100644
--- a/samples/client/petstore/csharp/src/main/csharp/io/swagger/client/ApiInvoker.cs
+++ b/samples/client/petstore/csharp/src/main/csharp/io/swagger/client/ApiInvoker.cs
@@ -53,10 +53,13 @@ public static string ParameterToString(object obj)
/// JSON string
/// Object type
/// Object representation of the JSON string
- public static object Deserialize(string json, Type type) {
+ public static object Deserialize(string content, Type type) {
+ if (type.GetType() == typeof(Object))
+ return (Object)content;
+
try
{
- return JsonConvert.DeserializeObject(json, type);
+ return JsonConvert.DeserializeObject(content, type);
}
catch (IOException e) {
throw new ApiException(500, e.Message);