The JSON string for a configured Highlighted Content web part can be retrieved using the following script:
Connect-PnPOnline -Url <siteURL>
$page = Get-PnPClientSidePage -Identity <PageName>
$page.controls
Here is the output:
Find the Highlighted Content web part property InstanceId
, and then you can retrieve the JSON string by executing:
$webpart = $page.Controls | ? {$_.InstanceId -eq "<InstanceId of the Highlighted Content WP>"}
$webpart.PropertiesJson
Reference:Working with modern client-side pages using PnP PowerShell
A sample from my test result:
{
"displayMaps":{
"1":{"headingText":{"sources":["SiteTitle"]},"headingUrl":{"sources":["SPWebUrl"]},"title":{"sources":["UserName","Title"]},"personImageUrl":{"sources":["ProfileImageSrc"]},"name":{"sources":["Name"]},"initials":{"sources":["Initials"]},"itemUrl":{"sources":["WebPath"]},"activity":{"sources":["ModifiedDate"]},"previewUrl":{"sources":["PreviewUrl","PictureThumbnailURL"]},"iconUrl":{"sources":["IconUrl"]},"accentColor":{"sources":["AccentColor"]},"cardType":{"sources":["CardType"]},"tipActionLabel":{"sources":["TipActionLabel"]},"tipActionButtonIcon":{"sources":["TipActionButtonIcon"]},"className":{"sources":["ClassName"]}},"2":{"column1":{"heading":"","sources":["FileType"],"width":34},"column2":{"heading":"Title","sources":["Title"],"linkUrls":["WebPath"],"width":250},"column3":{"heading":"Modified","sources":["ModifiedDate"],"width":100},"column4":{"heading":"Modified By","sources":["Name"],"width":150}},"3":{"id":{"sources":["UniqueID"]},"edit":{"sources":["edit"]},"DefaultEncodingURL":{"sources":["DefaultEncodingURL"]},"FileExtension":{"sources":["FileExtension"]},"FileType":{"sources":["FileType"]},"Path":{"sources":["Path"]},"PictureThumbnailURL":{"sources":["PictureThumbnailURL"]},"PreviewUrl":{"sources":["PreviewUrl"]},"SiteID":{"sources":["SiteID"]},"SiteTitle":{"sources":["SiteTitle"]},"Title":{"sources":["Title"]},"UniqueID":{"sources":["UniqueID"]},"WebId":{"sources":["WebId"]},"WebPath":{"sources":["WebPath"]}},"4":{"headingText":{"sources":["SiteTitle"]},"headingUrl":{"sources":["SPWebUrl"]},"title":{"sources":["UserName","Title"]},"personImageUrl":{"sources":["ProfileImageSrc"]},"name":{"sources":["Name"]},"initials":{"sources":["Initials"]},"itemUrl":{"sources":["WebPath"]},"activity":{"sources":["ModifiedDate"]},"previewUrl":{"sources":["PreviewUrl","PictureThumbnailURL"]},"iconUrl":{"sources":["IconUrl"]},"accentColor":{"sources":["AccentColor"]},"cardType":{"sources":["CardType"]},"tipActionLabel":{"sources":["TipActionLabel"]},"tipActionButtonIcon":{"sources":["TipActionButtonIcon"]},"className":{"sources":["ClassName"]}}
},
"query":{"contentLocation":5,"contentTypes":[1],"sortType":1,"filters":[{"filterType":1,"value":""}],"documentTypes":[99]},
"templateId":4,"maxItemsPerPage":100,"hideWebPartWhenEmpty":false,"sites":[],"queryMode":"Basic","layoutId":"FilmStrip","dataProviderId":"Search","webId":"<webId>","siteId":"<siteId>"
}
You can also see the link here for a sample json file
(original blog can be found via the first link from @Ganesh Sanap’s comment).