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
What it does
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-JsonIdentifyExample 2
@{Account="User01";Domain="Domain01";Admin="True"} | ConvertTo-Json -CompressIdentifyExample 3
Get-Date | Select-Object -Property * | ConvertTo-JsonIdentifyExample 4
Get-Date | Select-Object -Property * | ConvertTo-Json | ConvertFrom-JsonIdentifyIts page in the reference: ConvertTo-Json.
Parameters
-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.