JSONItem.Lookup

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!
Method

JSONItem.Lookup(Name As String, DefaultValue As Variant) As Variant

New in 2011r3

Supported for all project types and targets.

Looks up the passed value of Name. Returns a Variant.

Notes

If Name is found, it returns the corresponding value. If Name is not found, it returns the passed DefaultValue.

Example

Var myChild As New JSONItem

myChild.Value("Name") = "Fred"
myChild.value("Age") = 12
myChild.value("Married") = False

Var v As Variant
v = myChild.Lookup("Age", "Data not found")
MessageBox(v) // displays the value for Age