The process of building custom applications and tools that interact with Microsoft SharePoint, including SharePoint Online in Microsoft 365.
Use a display-only formatter that replaces the comma delimiter with a newline and preserves newline characters with white-space: pre-wrap.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"style": {
"color": "green",
"white-space": "pre-wrap",
"word-break": "break-word",
"margin": "5px 0"
},
"txtContent": "=replaceAll(toString(@currentField), ', ', '\n')"
}
Apply it from column menu → Column settings → Format this column → Advanced mode, then select Preview and Save. Column formatting changes only the displayed value; it does not modify the stored metadata.^1^
Why the existing forEach becomes unreliable
Your formatter assumes @currentField is an array:
"forEach": "choiceIterator in @currentField"
However, SharePoint’s formatting syntax documents forEach support for multi-value Person, Lookup, and Choice fields—not Managed Metadata fields.^2^ When Term plus parents is enabled, SharePoint can expose the fully qualified term display as a rendered string rather than an iterable collection usable by this formatter.
The replacement formatter therefore operates on the displayed string instead of trying to enumerate it.
Delimiter variations
If SharePoint returns commas without a following space, change:
"txtContent": "=replaceAll(toString(@currentField), ', ', '\n')"
to:
"txtContent": "=replaceAll(toString(@currentField), ',', '\n')"
Do not replace : unless you also want every level of a term path on a separate line. With Term plus parents, the colon represents the hierarchy—for example:
Badger Plant:AMERICAS:UNITED STATES
The column’s fully qualified-name setting controls whether SharePoint displays the entire path or only the term label.^3^
A limitation of delimiter replacement is that it also splits a term label containing an actual comma. There is no documented, supported forEach model for reliably enumerating multi-value Managed Metadata entries in JSON column formatting. If commas are valid inside your term labels and precise parsing is required, use an SPFx Field Customizer or copy the labels to a supported multi-value field for presentation.
References