Skip to content
ConsoleMonster
Cmdlet

Format-ConsoleJson

Module ConsoleMonster
Inputs
System.Object
Outputs
ConsoleMonster.Layout.IWidget

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 Sets

Description

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

Authored help example

EXAMPLE 1

Format-ConsoleJson -AsWidget

Parameters

-AsWidget SwitchParameter optional
Returns the view instead of writing it.
-Depth Int32 optional
The depth for ConvertTo-Json (default 4).
-InputObject Object optionalposition: 0pipeline: True (ByValue)
JSON text or objects (pipeline input).
-LineNumbers SwitchParameter optional
Shows line numbers.
-MaxLines Int32 optional
The most lines shown (default 2000).
-Title String optional
A panel title, or none.
-Width Int32 optional
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.