JSON 格式以名称-值对形式表示数据,运作方式类似于哈希表。 因此,与哈希表一样,JSON 不考虑名称或值中存在哪些类型的数据。 确定是哪种类型的数据是由使用 JSON 数据的脚本或应用程序负责的。 在PowerShell 中,使用ConvertTo-Json命令创建 JSON 格式的数据。 与其他ConvertTo命令...
JSON 格式以名称-值对形式表示数据,运作方式类似于哈希表。 因此,与哈希表一样,JSON 不考虑名称或值中存在哪些类型的数据。 确定是哪种类型的数据是由使用 JSON 数据的脚本或应用程序负责的。 在PowerShell 中,使用ConvertTo-Json命令创建 JSON 格式的数据。 与其他ConvertTo...
此命令使用ConvertTo-Json和ConvertFrom-Jsoncmdlet 将cmdlet 中的Get-Date对象转换为 JSON 对象,然后转换为PSCustomObject。 PowerShell Get-Date|Select-Object-Property* |ConvertTo-Json|ConvertFrom-JsonDisplayHint :2DateTime : Monday, January29,20243:10:26PM Date :1/29/202412:00:00AM Day :29DayOfWeek...
JsonObject.ConvertToJsonContext.MaxDepth FieldReference Feedback DefinitionNamespace: Microsoft.PowerShell.Commands Assembly: Microsoft.PowerShell.Commands.Utility.dll Package: Microsoft.PowerShell.Commands.Utility v7.4.0 Gets the maximum depth for walking the object graph. C# Αντιγρ...
Cmdlet Gets the target cmdlet that is doing the convert-to-json operation. CompressOutput Gets the CompressOutput setting. EnumsAsStrings Gets the EnumsAsStrings setting. MaxDepth Gets the maximum depth for walking the object graph. StringEscapeHandling Gets the StringEscapeHandling setting.Applies...
ConvertTo-Json[-InputObject] <Object> [-Depth <Int32>] [-Compress] [-EnumsAsStrings] [-AsArray] [-EscapeHandling <StringEscapeHandling>] [<CommonParameters>] 说明 ConvertTo-Jsoncmdlet 将任何 .NET 对象转换为 JavaScript 对象表示法 (JSON) 格式的字符串。 这些属性将转换为字段名称,字段值将转换...
Compare-Object ConvertFrom-CliXml ConvertFrom-Csv ConvertFrom-Json ConvertFrom-Markdown ConvertFrom-SddlString ConvertFrom-StringData ConvertTo-CliXml ConvertTo-Csv ConvertTo-Html ConvertTo-Json ConvertTo-Xml Debug-Runspace Disable-PSBreakpoint Disable-RunspaceDebug Enable-PSBreakpoint Enable-RunspaceDebug Expor...
DistinguishedName|Select-object -Property SAMAccountName, Name, @{name='Manager';expression={ ([ADSI]"LDAP://$($_.manager)").displayname }}, Enabled, DistinguishedName, Created, AccountExpirationDate, LastLogonTimestamp, PasswordLastSet|ConvertTo-Json ...
This example uses theConvertTo-Jsoncmdlet to convert aSystem.DateTimeobject from theGet-Datecmdlet to a JSON-formatted string. The command uses theSelect-Objectcmdlet to get all (*) of the properties of theDateTimeobject. The output shows the JSON string thatConvertTo-Jsonreturned. ...
$tokenByteArray = [System.Convert]::FromBase64String($tokenPayload) $tokenArray = ([System.Text.Encoding]::ASCII.GetString($tokenByteArray) | ConvertFrom-Json) #Converts $header and $tokenArray from PSCustomObject to Hashtable so they can be added together. ...