Thank you @Expiscornovus for trying to help.
this is my JSON that I am trying to add to a field:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"attributes": {
"class": "ms-fontColor-themePrimary ms-fontSize-m"
},
"children": [
{
"elmType": "span",
"style": {
"padding-right": "10px"
},
"attributes": {
"iconName": "Comment"
}
},
{
"elmType": "span",
"txtContent": "=if([$_CommentCount] == '' , 0 ,[$_CommentCount])"
}
]
}
as mentioned I have used it formatting a full list view using this api: _api/Lists/GetByTitle('listname')?['body/data/200']}')/Views('viewname') where I put this in the body successfully for formatting it:
{
'CustomFormatter':'{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
"additionalRowClass": {
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
{
"operator": "%",
"operands": [
"@rowIndex",
2
]
},
0
]
},
"sp-css-backgroundColor-BgLightGray30",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
{
"operator": "%",
"operands": [
"@rowIndex",
2
]
},
1
]
},
"sp-css-backgroundColor-noFill",
""
]
}
]
}
}'
}
I will look through you post and check if I will be successful with that. Thks