While doing some custom formatting for a List View, invalid JSON was checked-in and now, the List View will not render and I can't find a way to access the custom formatter without rendering the list and using "Format current view".

I'm aware of method using PnP but I don't have the permissions to execute it. Is there perhaps a way to glean the location from the PS script?

#Set the View Formatting
Set-PnPView -List $ListName -Identity $ViewName -Values @{CustomFormatter =$JSONFormat} -ErrorAction Stop
Write-host "View Format Applied Successfully!" -foregroundcolor Green

Source: https://www.sharepointdiary.com/2021/03/sharepoint-online-format-list-view-using-powershell.html#ixzz7wcGLGUSM

1 Answer 1


You can get the custom formatting applied on SharePoint list view using SharePoint REST API as well.

Use REST endpoint in below format:

https://contoso.sharepoint.com/sites/SPConnect/_api/web/lists/getbytitle('ChildList')/views/getbytitle('All Items')?$select=Title,CustomFormatter


Refer below code example for updating JSON view formatting:

<script type="text/javascript" src="/sites/SPConnect/SiteAssets/jquery.min.js"></script>
<script type="text/javascript">
    function updateViewJSONFormatting(listName, viewName) {
        var viewEndpoint = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('" + listName + "')/views/getbytitle('" + viewName + "')";

        var jsonFormatting = {
            "$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
            "additionalRowClass": "sp-field-severity--good"
        var viewProperties = {
            "__metadata": {
                "type": "SP.View"
            "CustomFormatter": JSON.stringify(jsonFormatting)

            url: viewEndpoint,
            type: "POST",
            headers: {
                "accept": "application/json;odata=verbose",
                "content-type": "application/json;odata=verbose",
                "X-RequestDigest": $("#__REQUESTDIGEST").val(),
                "X-HTTP-Method": "MERGE",
                "If-Match": "*"
            data: JSON.stringify(viewProperties),
            success: function(data) {
            error: function(error) {

You can call above function like:

updateViewJSONFormatting('Comments List', 'All Items')

Reference: SharePoint Online: Apply JSON View formatting using SharePoint REST API

  • That works. And to POST the changes back is the same URL? Mar 21, 2023 at 18:16
  • Check updated answer for POST Mar 22, 2023 at 6:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.