A sample project with a workspace view for inspecting and visualizing Umbraco document JSON for admin users in Umbraco 16.
Having a demo project that shows how you can add an extra Workspace View to the content section, allows you to add a JSON (debug) information when editing Umbraco documents for admin users only.
The "Magic" happens in the workspace conditions of the manifest file where we specify we only want this workspace view to show on the Document Workspace and only show this when the current logged in user is an admin user.
const workspaceViews: Array<ManifestWorkspaceView> = [
{
type: 'workspaceView',
alias: 'contentinspector.jsonView',
name: 'Json viewer for content inspector',
js: () => import('./jsonview.ts'),
weight: -200,
meta: {
icon: 'icon-script',
pathname: 'temp',
label: 'JSON'
},
conditions: [
{
alias: 'Umb.Condition.WorkspaceAlias',
match: 'Umb.Workspace.Document',
},
{
alias: 'Umb.Condition.CurrentUser.IsAdmin'
},
],
},
];
Download this Repository and run ContentInspector.Site. When logged in as admin you should see a nice extra workspace view that shows the json structure of the document
User: admin@test.com
Password: test123456
User: editor@test.com
Password: test123456
