Object Class
Using class dsobject you combine one or more attributes into a nested JSON object. A Confluence page can, for example, contain a table which is converted into a JSON array of objects, where rows are array elements and cells are object attributes:
<
table
class
=
"dsattr-participants"
>
...
<
tr
class
=
"dsobject"
>
...
<
td
class
=
"dsattr-lastname"
>
<
ac
:placeholder>Last name</
ac
:placeholder>
</
td
>
<
td
class
=
"dsattr-firstname"
>
<
ac
:placeholder>First name</
ac
:placeholder>
</
td
>
...
</
tr
>
...
</
table
>
The resulting JSON array:
{
"participants"
: [
...
{
...
"lastname"
:
"Doe"
,
"firstname"
:
"John"
,
...
}
...
]
}
If an attribute contains only one object than array is not created:
{
"participants"
: {
...
"lastname"
:
"Doe"
,
"firstname"
:
"John"
,
...
}
}
This rule in fact applies to all data types: if a table cell contains plain text in a single paragraph than it is converted into a text string, and if it contains two or more paragraphs of text than the value is a string array. Likewise several numbers are converted into an array of numbers, several dates – into an array of dates and so on.