<div class="meta" robots="noindex">

</div>

Method

# JSONItem.Compact

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2025r1. Please use `JSONItem.ToString<jsonitem.tostring>` with the `options</api/text/json/jsonoptions>` parameter as a replacement.

</div>

## Description

> When getting the `String</api/data_types/string>` representation of a <span class="title-ref">JSONItem</span> using the `ToString<jsonitem.tostring>` method, setting this property to `True</api/language/true>` (the default) will remove unnecessary whitespace from the resulting string. A value of `False</api/language/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</api/language/true>` before calling `ToString<jsonitem.tostring>`.

> ``` xojo
> 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.
