diff --git a/powershell/package.json b/powershell/package.json index fbc8b2852c4..db47313add4 100644 --- a/powershell/package.json +++ b/powershell/package.json @@ -1,6 +1,6 @@ { "name": "@autorest/powershell", - "version": "2.1.600", + "version": "2.1.700", "description": "AutoRest PowerShell Cmdlet Generator", "main": "dist/exports.js", "typings": "dist/exports.d.ts", diff --git a/powershell/resources/runtime/csharp/json/Customizations/IJsonSerializable.cs b/powershell/resources/runtime/csharp/json/Customizations/IJsonSerializable.cs index 6ff62c02a44..ceb12aa7026 100644 --- a/powershell/resources/runtime/csharp/json/Customizations/IJsonSerializable.cs +++ b/powershell/resources/runtime/csharp/json/Customizations/IJsonSerializable.cs @@ -157,6 +157,14 @@ internal static JsonNode ToJsonValue(object value) return Microsoft.Rest.ClientRuntime.JsonSerializable.ToJson(dictionary, null); } + // hashtables are converted to dictionaries for serialization + if (value is System.Collections.Hashtable hashtable) + { + var dict = new System.Collections.Generic.Dictionary(); + DictionaryExtensions.HashTableToDictionary(hashtable, dict); + return Microsoft.Rest.ClientRuntime.JsonSerializable.ToJson(dict, null); + } + // enumerable collections are handled like arrays (again, fallback to ToJson()/ToJsonString() or literal JsonString) if (value is System.Collections.IEnumerable enumerableValue) {