JSONException
From Xojo Documentation
You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site! |
Class (inherits from RuntimeException)
New in 2011r2
An error occurred when working with a JSONItem.
Properties | ||
|
Methods | ||
|
Sample Code
The following Exception block catches any JSONItem errors in the method.
Var person As New JSONItem
// This object is manipulated like a dictionary
person.Value("Name") = "John Doe"
person.Value("Age") = 32
person.Value("Married") = True
person.Value("Spouse") = "Jane Doe"
Var kids As New JSONItem
// This object is manipulated like an array
kids.Add("John Jr")
kids.Add("Jamie")
kids.Add("Jack")
kids.Add("Josie")
kids.AddAt(0, "Jen")
kids.RemoveAt(2)
person.Value("Kids") = kids
person.Compact = True
Var s As String = person.ToString
TextArea1.Text = s
ListBox1.RemoveAllRows
ShowJSONObject(person)
Exception err As JSONException
MessageBox("A JSONException has occurred.")
// This object is manipulated like a dictionary
person.Value("Name") = "John Doe"
person.Value("Age") = 32
person.Value("Married") = True
person.Value("Spouse") = "Jane Doe"
Var kids As New JSONItem
// This object is manipulated like an array
kids.Add("John Jr")
kids.Add("Jamie")
kids.Add("Jack")
kids.Add("Josie")
kids.AddAt(0, "Jen")
kids.RemoveAt(2)
person.Value("Kids") = kids
person.Compact = True
Var s As String = person.ToString
TextArea1.Text = s
ListBox1.RemoveAllRows
ShowJSONObject(person)
Exception err As JSONException
MessageBox("A JSONException has occurred.")
See Also
JSONItem, RuntimeException class.