CmdID

CmdID / PowerShell / Cmdlets / ConvertTo

ConvertTo-Json

Converts an object to a JSON-formatted string. PowerShell reference

From the PowerShell reference 3 parameters 1 Sigma rule looks for it

Opens CmdID with your command, read as PowerShell. It is read in your browser and sent nowhere.

What it does

from the PowerShell reference, CC BY 4.0

Converts an object to a JSON-formatted string. The ConvertTo-Json cmdlet converts any .NET object to a string in JavaScript Object Notation (JSON) format. The properties are converted to field names, the field values are converted to property values, and the methods are removed. You can then use the ConvertFrom-Json cmdlet to convert a JSON-formatted string to a JSON object, which is easily managed in PowerShell. Many web sites use JSON instead of XML to serialize data for communication between servers and web-based apps. This cmdlet was introduced in Windows PowerShell 3.0.

ConvertTo-Json [-InputObject] <Object> [-Depth <Int32>] [-Compress] [<CommonParameters>]

Example 1

(Get-UICulture).Calendar | ConvertTo-JsonIdentify

Example 2

@{Account="User01";Domain="Domain01";Admin="True"} | ConvertTo-Json -CompressIdentify

Example 3

Get-Date | Select-Object -Property * | ConvertTo-JsonIdentify

Example 4

Get-Date | Select-Object -Property * | ConvertTo-Json | ConvertFrom-JsonIdentify

Its page in the reference: ConvertTo-Json.

Parameters

3 in the PowerShell reference
-CompressOmits white space and indented formatting in the output string.
-DepthSpecifies how many levels of contained objects are included in the JSON representation. The value can be any number from 1 to 100. The default value is 2. ConvertTo-Json emits a warning if the number of levels in an input object exceeds this number.
-InputObjectSpecifies the objects to convert to JSON format. Enter a variable that contains the objects, or type a command or expression that gets the objects. You can also pipe an object to ConvertTo-Json. The InputObject parameter is required, but its value can be null ($null) or an empty string. When the input object is $null, ConvertTo-Json does not generate any output. When the input object is an empty string, ConvertTo-Json returns an empty string.

What looks for it

Sigma process creation rules that name ConvertTo-Json
mediumPotentially Suspicious Powershell Script Execution From Temp FolderFlorian Roth (Nextron Systems), Max Altgelt (Nextron Systems), Tim Shelton