TomlBlockArray

@SerialInfo
@Target(allowedTargets = [AnnotationTarget.PROPERTY])
annotation class TomlBlockArray(val itemsPerLine: Int = 1)(source)

Modify the encoding of corresponding array-like property, either to force array of tables to be encoded as block array, or to change how many items will be encoded per line (will override TomlConfig).

Note: If the corresponding property is marked TomlInline, this annotation will not take effect.

data class NullablePairList<F, S>(
@TomlBlockArray(2)
val list: List<Pair<F, S>?>
)
NullablePairList(listOf(Pair("key", 1), null, Pair("key", 3), Pair("key", 4)))

will produce:

list = [
{ first = "key", second = 1 }, null,
{ first = "key", second = 3 }, { first = "key", second = 4 }
]

Properties

Link copied to clipboard
val itemsPerLine: Int = 1