Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' it will print all open files to printer
- const module_name = "FormatJson"
- const module_ver = "1.0"
- sub JSONPretify
- set obj = NewEditor()
- obj.assignActiveEditor()
- set json = CreateObject("Chilkat_9_5_0.JsonObject")
- success = json.Load(obj.text)
- If (success <> 1) Then
- WScript.Quit
- End If
- ' To pretty-print, set the EmitCompact property equal to 0
- json.EmitCompact = 0
- ' If bare-LF line endings are desired, turn off EmitCrLf
- ' Otherwise CRLF line endings are emitted.
- json.EmitCrLf = 1
- ' Emit the formatted JSON:
- obj.text( json.Emit() )
- end sub
- ' name "Init" is required, its called automatically during initialization to create menu items
- Sub Init
- addMenuItem "JSON Pretify", "Format code", "JSONPretify", "Shift+Ctrl+J"
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement