Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS Util Plugin
Last modified Tue, 11th Dec 2023.
You find this example project in your MBS Xojo Plugin download as a Xojo project file within the examples folder: /Util/JSON/JSON To HTML
Download this example: JSON To HTML.zip
Project "JSON To HTML.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control JSONArea Inherits TextArea
ControlInstance JSONArea Inherits TextArea
EventHandler Sub TextChange()
UpdateTimer.Mode = UpdateTimer.ModeSingle
End EventHandler
End Control
Control HTMLArea Inherits TextArea
ControlInstance HTMLArea Inherits TextArea
End Control
Control web Inherits HTMLViewer
ControlInstance web Inherits HTMLViewer
End Control
Control UpdateTimer Inherits Timer
ControlInstance UpdateTimer Inherits Timer
EventHandler Sub Action()
Update
End EventHandler
End Control
EventHandler Sub Open()
update
End EventHandler
Sub Update()
// parse JSON
Dim j As New JSONMBS(JSONArea.Text)
// make HTML
Dim html As String = j.ToHTML
// show it
HTMLArea.Text = html
// load to web viewer
web.LoadPage(html, Nil)
// if something goes wrong, we show in htmltext field
Exception r As JSONException
HTMLArea.Text = r.message
End Sub
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
MenuItem HelpMenu = "&Help"
End MenuBar
Sign
End Sign
End Project
See also:
- /Util/JSON/JSON
- /Util/JSON/JSON Benchmark
- /Util/JSON/JSON Benchmarks
- /Util/JSON/JSON Query Tests
- /Util/JSON/JSON recursive search
Download this example: JSON To HTML.zip
The items on this page are in the following plugins: MBS Util Plugin.