JSONItem.Compact

From Xojo Documentation

Property (As Boolean )
aJSONItem.Compact = newBooleanValue
or
BooleanValue = aJSONItem.Compact

New in 2011r2

Supported for all project types and targets.

When getting the String representation of a JSONItem using the ToString method, setting this property to True (the default) will remove unnecessary whitespace from the resulting string. A value of False will result in a string with SPACEs and EndOfLines embedded to make the string more readable.

Example

This example sets Compact to True before calling ToString.

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,"Jonah")
kids.RemoveAt(2)
person.Value("Kids") = kids

Person.Compact = True
Var s As String = person.ToString