diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/ConvertToJsonCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/ConvertToJsonCommand.cs
index d179a8c4feb..afdc300d717 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/ConvertToJsonCommand.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/ConvertToJsonCommand.cs
@@ -2,22 +2,12 @@
// Licensed under the MIT License.
using System;
-using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
-using System.Globalization;
-using System.Reflection;
-using System.Text;
-using Dbg = System.Management.Automation;
using System.Management.Automation;
using System.Management.Automation.Internal;
-
+using System.Threading;
using Newtonsoft.Json;
-using Newtonsoft.Json.Converters;
-
-// FxCop suppressions for resource strings:
-[module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "WebCmdletStrings.resources", MessageId = "json")]
-[module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "WebCmdletStrings.resources", MessageId = "Json")]
namespace Microsoft.PowerShell.Commands
{
@@ -29,7 +19,6 @@ namespace Microsoft.PowerShell.Commands
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
public class ConvertToJsonCommand : PSCmdlet
{
- #region parameters
///
/// Gets or sets the InputObject property.
///
@@ -39,13 +28,18 @@ public class ConvertToJsonCommand : PSCmdlet
private int _depth = 2;
private const int maxDepthAllowed = 100;
+ private readonly CancellationTokenSource cancellationSource = new CancellationTokenSource();
///
/// Gets or sets the Depth property.
///
[Parameter]
[ValidateRange(1, int.MaxValue)]
- public int Depth { get { return _depth; } set { _depth = value; } }
+ public int Depth
+ {
+ get { return _depth; }
+ set { _depth = value; }
+ }
///
/// Gets or sets the Compress property.
@@ -82,10 +76,6 @@ public class ConvertToJsonCommand : PSCmdlet
[Parameter]
public StringEscapeHandling EscapeHandling { get; set; } = StringEscapeHandling.Default;
- #endregion parameters
-
- #region overrides
-
///
/// Prerequisite checks.
///
@@ -105,7 +95,7 @@ protected override void BeginProcessing()
private List