Cmdlet
Format-ConsoleJson
Shows JSON with syntax highlighting: JSON text, or objects converted with ConvertTo-Json.
Syntax
Format-ConsoleJson [-AsWidget] [-Depth <Int32>] [[-InputObject] <Object>] [-LineNumbers] [-MaxLines <Int32>] [-Title <String>] [-Width <Int32>] [<CommonParameters>]#Parameter set:
All Parameter SetsDescription
Shows JSON with syntax highlighting: JSON text, or objects converted with ConvertTo-Json.
A thin convenience over Format-ConsoleCode -Language Json. Strings are taken as JSON text (pipeline strings are joined, so Get-Content works); other objects are collected and converted with ConvertTo-Json -Depth (default 4) first.
Examples
EXAMPLE 1
Format-ConsoleJson -AsWidgetParameters
- -AsWidget SwitchParameter
- Returns the view instead of writing it.
- -Depth Int32
- The depth for ConvertTo-Json (default 4).
- -InputObject Object
- JSON text or objects (pipeline input).
- -LineNumbers SwitchParameter
- Shows line numbers.
- -MaxLines Int32
- The most lines shown (default 2000).
- -Title String
- A panel title, or none.
- -Width Int32
- Lays the output out for this width instead of the terminal's.
Common Parameters
This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
For more information, see about_CommonParameters.