If you are talking about SharePoint default "Created By" & "Modified By" columns, it is possible to format this columns using JSON.
I have used the same JSON code in your previous question and it is working fine for me, adding the same code here for reference:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"style": {
"flex-direction": "column",
"align-items": "flex-start",
"margin-top": "6px",
"padding-right": "8px",
"width": "100%",
"overflow": "hidden"
},
"children": [
{
"forEach": "personIterator in @currentField",
"elmType": "div",
"attributes": {
"class": "ms-bgColor-neutralLight ms-fontColor-neutralSecondary"
},
"style": {
"display": "inline-flex",
"align-items": "center",
"height": "28px",
"overflow": "hidden",
"border-radius": "12px",
"padding-right": "8px",
"margin": "2px"
},
"children": [
{
"elmType": "img",
"attributes": {
"src": "='/_layouts/15/userphoto.aspx?size=S&accountname=' + [$personIterator.email]",
"title": "[$personIterator.title]"
},
"style": {
"width": "28px",
"height": "28px",
"display": "block",
"border-radius": "50%"
}
},
{
"elmType": "div",
"txtContent": "[$personIterator.title]",
"attributes": {
"title": "[$personIterator.title]",
"class": "nameplate-title"
},
"style": {
"padding-left": "5px",
"white-space": "nowrap",
"font-size": "12px"
}
}
],
"defaultHoverField": "[$personIterator]"
}
]
}
Output:
Note: This code is for multiple selections of users. It works for both single/multiple selections. But if you want, you can convert it for single selection only.
You can find other supported/unsupported columns in JSON formatting at Microsoft documentation: Column formatting - Supported column types
If this above approach is not working for you then you can try using below in src
property of img
element (instead of creating image URL on your own):
personIterator.picture
As person or group column in JSON supports below properties at this time (sample data):
{
"id": "122",
"title": "Kalya Tucker",
"email": "[email protected]",
"sip": "[email protected]",
"picture": "https://contoso.sharepoint.com/kaylat_contoso_com_MThumb.jpg?t=63576928822",
"department":"Human Resources",
"jobTitle":"HR Manager"
}
Source: Column formatting - Special string values
<siteUrl>/_layouts/15/userphoto.aspx?size=S&accountname=<email-address>