Platforms to show: All Mac Windows Linux Cross-Platform

Back to JSONMBS class.

JSONMBS.ArraySize as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript Object Notation MBS Util Plugin 13.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries size of array.

For objects returns number of keys.
Same as Count property.
(Read only property)

Some examples using this property:

JSONMBS.ChildNode as JSONMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript Object Notation MBS Util Plugin 13.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The first child node.
Example
Var o as JSONMBS = JSONMBS.NewArrayNode

o.AddItemToArray JSONMBS.NewNumberNode(1)
o.AddItemToArray JSONMBS.NewNumberNode(2)
o.AddItemToArray JSONMBS.NewNumberNode(3)
o.AddItemToArray JSONMBS.NewNumberNode(4)

Var n as JSONMBS = o.ChildNode // first child
MsgBox n.ValueString // shows 1

Please move to newer iterator functions instead.
(Read only property)

Some examples using this property:

JSONMBS.Compact as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript Object Notation MBS Util Plugin 23.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Whether to prefer compact output for toString property.
Example
Var j As New JSONMBS
j.Value("Hello") = "World"

Var s As String = j.toString
j.compact = false
Var f As String = j.toString

Break // see difference?

Default is true.
Set to false to get formatted output.
Or call ToString method with parameter.
(Read and Write property)

JSONMBS.Count as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript Object Notation MBS Util Plugin 23.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries size of array.
Example
Var o As New JSONMBS

o.add 1
o.add 2
o.add 3

MessageBox o.Count.ToString // shows 3

For objects returns number of keys.
Same as ArraySize property.
(Read only property)

JSONMBS.Handle as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript Object Notation MBS Util Plugin 13.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The internal handle to the JSON object.

It is possible to have two Xojo objects with the same handle pointing to the same JSON node.
(Read only property)

JSONMBS.LastChildNode as JSONMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript Object Notation MBS Util Plugin 13.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The last child node.
Example
Var o as JSONMBS = JSONMBS.NewArrayNode

o.AddItemToArray JSONMBS.NewNumberNode(1)
o.AddItemToArray JSONMBS.NewNumberNode(2)
o.AddItemToArray JSONMBS.NewNumberNode(3)
o.AddItemToArray JSONMBS.NewNumberNode(4)

Var k as JSONMBS = o.LastChildNode
MsgBox k.ValueString // shows 4

(Read only property)

Some examples using this property:

JSONMBS.LastRowIndex as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript Object Notation MBS Util Plugin 23.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries last row index.
Example
Var j As New JSONMBS

j.add 1
j.add 2
j.add 3

MessageBox j.LastRowIndex.ToString // shows 2

Same as Count-1.
(Read only property)

JSONMBS.Name as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript Object Notation MBS Util Plugin 13.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The name of this node.

(Read only property)

See also:

JSONMBS.NextNode as JSONMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript Object Notation MBS Util Plugin 13.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The next node on the same level.
Example
Var o as JSONMBS = JSONMBS.NewArrayNode

o.AddItemToArray JSONMBS.NewNumberNode(1)
o.AddItemToArray JSONMBS.NewNumberNode(2)
o.AddItemToArray JSONMBS.NewNumberNode(3)
o.AddItemToArray JSONMBS.NewNumberNode(4)

Var k as JSONMBS = o.ChildNode
while k<>nil
MsgBox k.ValueString // shows 1, 2, 3, 4

k=k.NextNode
wend

Please move to newer iterator functions instead.
(Read only property)

JSONMBS.PreviousNode as JSONMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript Object Notation MBS Util Plugin 13.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The previous node on the same level.
Example
Var o as JSONMBS = JSONMBS.NewArrayNode

o.AddItemToArray JSONMBS.NewNumberNode(1)
o.AddItemToArray JSONMBS.NewNumberNode(2)
o.AddItemToArray JSONMBS.NewNumberNode(3)
o.AddItemToArray JSONMBS.NewNumberNode(4)

Var k as JSONMBS = o.LastChildNode
while k<>nil
MsgBox k.valuestring // shows 4, 3, 2, 1

k=k.PreviousNode
wend

Please move to newer iterator functions instead.
(Read only property)

JSONMBS.Root as JSONMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript Object Notation MBS Util Plugin 13.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The root object.

The root node owns the references to all children.
(Read only property)

JSONMBS.Tag as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript Object Notation MBS Util Plugin 23.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The semantic tag.

This can give a value as more detailed meaning on the usage.
e.g. we often have strings to hold numbers to preserve all digits.
(Read only property)

JSONMBS.toString as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript Object Notation MBS Util Plugin 14.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Produces a JSON markup text document from a document tree.
Example
Var o as JSONMBS = JSONMBS.NewObjectNode

o.AddItemToObject "text", JSONMBS.NewStringNode("Hello World")

MsgBox o.toString // shows "{"text":"Hello World"}"

Returns "" on any error. Lasterror is set.
(Read only property)

See also:

JSONMBS.Type as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript Object Notation MBS Util Plugin 13.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The type of the node.
Example
Var n as JSONMBS = JSONMBS.NewNullNode

MsgBox str(n.Type)

(Read only property)

JSONMBS.TypeName as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript Object Notation MBS Util Plugin 12.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Shows type of this node as string.
Example
Var o as JSONMBS = JSONMBS.NewArrayNode
MsgBox o.TypeName

This property was added for debugging so you can see type in debugger.
(Read only property)

JSONMBS.Valid as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript Object Notation MBS Util Plugin 16.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Checks whether node is valid.

The handle is not zero and there are no error nodes in JSON tree.
Returns true if valid, else false.
(Read only property)

JSONMBS.Value as Variant

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript Object Notation MBS Util Plugin 23.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries the value of this JSON.
Example
Var j1 As JSONMBS = JSONMBS.NewStringNode("Hello World")
Var v1 As Variant = j1.Value
Var j2 As JSONMBS = JSONMBS.NewNumberNode(123)
Var v2 As Variant = j2.Value
Var j3 As JSONMBS = JSONMBS.NewNumberNode("1234.567")
Var v3 As Variant = j3.Value
Var j4 As JSONMBS = JSONMBS.NewCurrencyNode(123.4567)
Var v4 As Variant = j4.Value

Break

Converts value to variant.
(Read only property)

See also:

JSONMBS.ValueBoolean as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript Object Notation MBS Util Plugin 17.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The boolean value of this json node.

Returns true if type is kTypeTrue, false if kTypeFalse or true if ValueInteger <> 0.
(Read only property)

Some examples using this property:

JSONMBS.ValueByteString as MemoryBlock

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript Object Notation MBS Util Plugin 23.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries byte string as MemoryBlock
Example
Var mem As MemoryBlock = "Hello World"

// we send a MemoryBlock into our JSON
Var dic As New Dictionary
dic.Value("test") = mem

Var j As New JSONMBS(dic)
MessageBox j.toString // auto encodes it as base64

// let's query value from child()
Var jm As JSONMBS = j.Child("test")
Var m1 As MemoryBlock = jm.ValueByteString

// and query via value()
Var m2 As MemoryBlock = j.Value("test")

Break

Returns nil if type is not kTypeByteString.
(Read only property)

JSONMBS.ValueDouble as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript Object Notation MBS Util Plugin 13.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The value of the node.

(Read only property)

Some examples using this property:

JSONMBS.ValueInt64 as Int64

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript Object Notation MBS Util Plugin 23.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The Int64 value of the node.

If the node is an Int64, we return it.
Otherwise we try to convert it.
May raise exception if value can't be converted.
(Read only property)

Some examples using this property:

JSONMBS.ValueInteger as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript Object Notation MBS Util Plugin 23.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The Integer value of the node.

If the node is an integer, we return it.
Otherwise we try to convert it.
May raise exception if value can't be converted.
(Read only property)

Some examples using this property:

JSONMBS.ValueString as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript Object Notation MBS Util Plugin 13.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The value of the node.

(Read only property)

JSONMBS.ValueUInt64 as UInt64

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript Object Notation MBS Util Plugin 23.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The UInt64 value of the node.

If the node is an UInt64, we return it.
Otherwise we try to convert it.
May raise exception if value can't be converted.
(Read only property)

Some examples using this property:

The items on this page are in the following plugins: MBS Util Plugin.


The biggest plugin in space...