From 518987a371a83676c8cdee51f4ae6c1f492e6331 Mon Sep 17 00:00:00 2001 From: Peter Ombwa Date: Fri, 10 Dec 2021 12:18:11 -0800 Subject: [PATCH 1/2] Serialize hashtables. --- .../csharp/json/Customizations/IJsonSerializable.cs | 8 ++++++++ 1 file changed, 8 insertions(+) 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) { From dcc0f498ff46e70b656cf51e445bb378fa6d0c8e Mon Sep 17 00:00:00 2001 From: Peter Ombwa Date: Fri, 10 Dec 2021 12:24:39 -0800 Subject: [PATCH 2/2] Bump version. --- powershell/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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",