From 6904f1951517c2e933c59c272ea0487a37a7e5aa Mon Sep 17 00:00:00 2001 From: Yunchi Wang <54880216+wyunchi-ms@users.noreply.github.com> Date: Wed, 24 Feb 2021 18:32:10 +0800 Subject: [PATCH] [Automation]Fix the issue of automation in string (#14314) * Fix the issue of automation in string * Update Changelog.md Co-authored-by: wyunchi-ms --- src/Automation/Automation/ChangeLog.md | 1 + src/Automation/Automation/Common/PowershellJsonConverter.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Automation/Automation/ChangeLog.md b/src/Automation/Automation/ChangeLog.md index ab5b36fed5a8..7b647cb94bfa 100644 --- a/src/Automation/Automation/ChangeLog.md +++ b/src/Automation/Automation/ChangeLog.md @@ -18,6 +18,7 @@ - Additional information about change #1 --> ## Upcoming Release +* Fixed the issue that string cannot be serialized correctly. [#14215] * Added Support for Python3 Runbook Type ## Version 1.4.3 diff --git a/src/Automation/Automation/Common/PowershellJsonConverter.cs b/src/Automation/Automation/Common/PowershellJsonConverter.cs index 1504b514c58d..8150c8e37027 100644 --- a/src/Automation/Automation/Common/PowershellJsonConverter.cs +++ b/src/Automation/Automation/Common/PowershellJsonConverter.cs @@ -36,7 +36,7 @@ public static string Serialize(object inputObject) } if (inputObject is string @str) { - return str.Trim(); + return JsonConvert.SerializeObject(str.Trim()); } else if (inputObject is object[] @objectArray) {