Skip to content

Instantly share code, notes, and snippets.

Created June 18, 2016 03:16
What would you like to do?
Function Out-JSONView {
Param (
[int]$Depth = 2
$JSON = @($Input) | ConvertTo-Json -Depth $Depth | Out-String
$WebPage = @"
<title>JSONEditor | Switch mode</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- when using the mode "code", it's important to specify charset utf-8 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<link href="" rel="stylesheet" type="text/css">
<script src=""></script>
<style type="text/css">
body {
font: 10.5pt arial;
color: #4d4d4d;
line-height: 150%;
width: 100%;
code {
background-color: #f5f5f5;
#jsoneditor {
width: 90%;
Switch editor mode using the mode box.
Note that the mode can be changed programmatically as well using the method
<code>editor.setMode(mode)</code>, try it in the console of your browser.
<div id="jsoneditor"></div>
var container = document.getElementById('jsoneditor');
var options = {
mode: 'tree',
modes: ['code', 'form', 'text', 'tree', 'view'], // allowed modes
onError: function (err) {
onModeChange: function (newMode, oldMode) {
console.log('Mode switched from', oldMode, 'to', newMode);
var json = $JSON
var editor = new JSONEditor(container, options, json);
[xml]$XAML = @'
Title="PowerShell HTML GUI" WindowStartupLocation="CenterScreen">
<WebBrowser Name="WebBrowser"></WebBrowser>
#Read XAML
$reader=(New-Object System.Xml.XmlNodeReader $xaml)
$Form=[Windows.Markup.XamlReader]::Load( $reader )
# Store Form Objects In PowerShell
$WebBrowser = $Form.FindName("WebBrowser")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment