Method

JSONItem.Compact


Warning

This item was deprecated in version 2025r1. Please use JSONItem.ToString with the options parameter as a replacement.

Description

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.

Sample code

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

Compatibility

All project types on all supported operating systems.