SharePoint Modern List - How to Tell Which Columns have JSON Formatting

Crazy Dance 20 Reputation points
2023-06-27T21:47:39.29+00:00

Hau,

I am working in SharePoint Online Modern, and I have inherited a list with lots of columns and lots of JSON Column formatting (or so I am told).

My question is this, is there an easy way to tell which columns in a 50+ column list have JSON formatting?

Thanks!

Wachi

Microsoft 365 and Office | SharePoint | Development
Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2023-06-28T02:59:29.29+00:00

    Hi @Crazy Dance,

    When a column uses JSONformatting, its SchemaXml will contain an attribute called CustomFormatter.

    Here you can use Power shell to determine whether the SchemaXml of the column contains the CustomFormatter attribute to determine whether the column uses JSON formatting

    Here is a test for your reference:

    Here is test list:

    User's image

    Here is test columns:

    User's image

    User's image

    Here is aa column:

    User's image

    Here is test:

    Here is code:

    # Connect to SharePoint Online
    Connect-PnPOnline -Url "yoursiteURL"
    
    
    $list = Get-PnPList -Identity "testforjson"
    $fields = Get-PnPProperty -ClientObject $list -Property Fields
    foreach ($field in $fields) {
        if ($field.SchemaXml.Contains("CustomFormatter")) {
            Write-Host "Column Name: $($field.Title)"
            Write-Host "Column Internal Name: $($field.InternalName)"
            Write-Host "CustomFormatter: Yes"
            Write-Host "---------------------------"
        }
    }
    
    
    
    # Disconnect from SharePoint Online
    Disconnect-PnPOnline
    
    

    Here is result:

    User's image


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best Regards

    Cheng Feng

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.