AutoIt
AutoIt
Pretty Print JSON (Formatter, Beautifier)
See more JSON Examples
Demonstrates how to emit JSON in a pretty, human-readable format with indenting of nested arrays and objects.Chilkat AutoIt Downloads
Local $bSuccess = False
$oJson = ObjCreate("Chilkat.JsonObject")
Local $sJsonStr = "{""name"": ""donut"",""image"":{""fname"": ""donut.jpg"",""w"": 200,""h"": 200},""thumbnail"":{""fname"": ""donutThumb.jpg"",""w"": 32,""h"": 32}}"
$bSuccess = $oJson.Load($sJsonStr)
If ($bSuccess <> True) Then
ConsoleWrite($oJson.LastErrorText & @CRLF)
Exit
EndIf
; To pretty-print, set the EmitCompact property equal to False
$oJson.EmitCompact = False
; If bare-LF line endings are desired, turn off EmitCrLf
; Otherwise CRLF line endings are emitted.
$oJson.EmitCrLf = False
; Emit the formatted JSON:
ConsoleWrite($oJson.Emit() & @CRLF)