Platforms to show: All Mac Windows Linux Cross-Platform
/Util/JSON
Feedback.
Function:
You find this example project in your Plugins Download as a Realbasic project file within the examples folder: /Util/JSON
This example is the version from Sat, 8th Jan 2010.
Notes: Last modified: Sat, 8th Jan 2010
Feedback.
Function:
You find this example project in your Plugins Download as a Realbasic project file within the examples folder: /Util/JSON
This example is the version from Sat, 8th Jan 2010.
Notes: Last modified: Sat, 8th Jan 2010
Class App
Inherits Application
// Constants
Const kFileQuitShortcut = Ctrl+Q
Const kFileQuit = &Beenden
Const kEditClear =
End Class
Class Window1
Inherits Window
// Controls
ControlInstance
End ControlInstance
ControlInstance
Sub Action() Handles Event
dim j as new JSONMBS(EditField1.text)
Add j
EditField2.text = JSONMBS.FormatString(j.toString)
End Sub
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
Sub ExpandRow(row As Integer) Handles Event
dim j as JSONMBS = List.CellTag(row,0)
dim c as JSONMBS = j.ChildNode
while c<>Nil
add c
c=c.NextNode
wend
End Sub
End ControlInstance
ControlInstance
Sub Action() Handles Event
dim j as JSONMBS = BuildTest
Add j
EditField2.text = JSONMBS.FormatString(j.toString)
End Sub
End ControlInstance
// Methods
Private Sub Add(j as JSONMBS)
dim t as string
Select case j.Type
case j.kTypeArray
t="Array: "
case j.kTypeNumber
t="Number: "
case j.kTypeObject
t="Object: "
case j.kTypeString
t="String: "
case j.kTypeTrue
t="True"
case j.kTypeFalse
t="False"
case j.kTypeNull
t="Null"
end Select
if j.ChildNode<>nil then
List.AddFolder t+j.Text
else
List.AddRow t+j.Text
end if
List.CellTag(List.LastIndex,0)=j
End Sub
Private Function BuildTest() As JSONMBS
dim j as JSONMBS = JSONMBS.NewObjectNode
j.InsertPairIntoObject "String Node", JSONMBS.NewStringNode("Hello World")
j.InsertPairIntoObject "False Node", JSONMBS.NewFalseNode
j.InsertPairIntoObject "True Node", JSONMBS.NewTrueNode
j.InsertPairIntoObject "Null Node", JSONMBS.NewNullNode
dim o as JSONMBS = JSONMBS.NewObjectNode
o.InsertPairIntoObject "x", JSONMBS.NewStringNode("a")
o.InsertPairIntoObject "y", JSONMBS.NewStringNode("b")
o.InsertPairIntoObject "z", JSONMBS.NewStringNode("c")
j.InsertPairIntoObject "Object Node", o
j.InsertPairIntoObject "Number Node", JSONMBS.NewNumberNode("8")
dim a as JSONMBS = JSONMBS.NewArrayNode
for i as integer = 1 to 10
a.InsertChild JSONMBS.NewNumberNode(str(i))
next
j.InsertPairIntoObject "Array Node",a
Return j
End Function
End Class
Links
MBS REAL studio Plugins - Christians Software aus Nickenich