Dashboard JSON model
This documentation topic is designed for Grafana workspaces that support Grafana version 10.x.
For Grafana workspaces that support Grafana version 9.x, see Working in Grafana version 9.
For Grafana workspaces that support Grafana version 8.x, see Working in Grafana version 8.
A dashboard in Grafana is represented by a JSON object, which stores metadata of its dashboard. Dashboard metadata includes dashboard properties, metadata from panels, template variables, and panel queries.
To view the JSON of a dashboard
-
Navigate to a dashboard.
-
In the top navigation menu, select the Dashboard settings (gear) icon.
-
Select JSON Model.
JSON fields
When a user creates a new dashboard, a new dashboard JSON object is initialized with the following fields.
Note
In the following JSON, id is shown as null, which is the default value
assigned to it until a dashboard is saved. After a dashboard is saved, an
integer value is assigned to the id
field.
{ "id": null, "uid": "cLV5GDCkz", "title": "New dashboard", "tags": [], "timezone": "browser", "editable": true, "graphTooltip": 1, "panels": [], "time": { "from": "now-6h", "to": "now" }, "timepicker": { "time_options": [], "refresh_intervals": [] }, "templating": { "list": [] }, "annotations": { "list": [] }, "refresh": "5s", "schemaVersion": 17, "version": 0, "links": [] }
The following describes each field in the dashboard JSON.
Name | Usage |
---|---|
|
unique numeric identifier for the dashboard (generated by the db) |
|
unique dashboard identifier that can be generated by anyone. string (8-40) |
|
current title of dashboard |
|
tags associated with dashboard, an array of strings |
|
theme of dashboard, such as |
|
timezone of dashboard, such as |
|
whether a dashboard is editable or not |
|
0 for no shared crosshair or tooltip (default), 1 for shared crosshair, 2 for shared crosshair and shared tooltip |
|
time range for dashboard, such as |
|
timepicker metadata, see timepicker section for details |
|
templating metadata, see templating section for details |
|
annotations metadata, see annotations for how to add them |
|
auto-refresh interval |
|
version of the JSON schema (integer), incremented each time a Grafana update brings changes to this schema |
|
version of the dashboard (integer), incremented each time the dashboard is updated |
|
panels array (see the next section for detail) |
Panels
Panels are the building blocks of a dashboard. It consists of data source queries, type of graphs, aliases, and more. Panel JSON consists of an array of JSON objects, each representing a different panel. Most of the fields are common for all panels but some fields depend on the panel type. The following is an example of panel JSON of a text panel.
"panels": [ { "type": "text", "title": "Panel Title", "gridPos": { "x": 0, "y": 0, "w": 12, "h": 9 }, "id": 4, "mode": "markdown", "content": "# title" }
Panel size and position
The gridPos property describes the panel size and position in grid coordinates.
-
w
– 1 to 24 (the width of the dashboard is divided into 24 columns) -
h
– In grid height units, each represents 30 pixels. -
x
– The x position, in the same unit asw
. -
y
– The y position, in the same unit ash
.
The grid has a negative gravity that moves up panels if there is empty space above a panel.
Timepicker
"timepicker": { "collapse": false, "enable": true, "notice": false, "now": true, "refresh_intervals": [ "5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d" ], "status": "Stable", "type": "timepicker" }
Templating
The templating
field contains an array of template variables with
their saved values along with some other metadata.
"templating": { "enable": true, "list": [ { "allFormat": "wildcard", "current": { "tags": [], "text": "prod", "value": "prod" }, "datasource": null, "includeAll": true, "name": "env", "options": [ { "selected": false, "text": "All", "value": "*" }, { "selected": false, "text": "stage", "value": "stage" }, { "selected": false, "text": "test", "value": "test" } ], "query": "tag_values(cpu.utilization.average,env)", "refresh": false, "type": "query" }, { "allFormat": "wildcard", "current": { "text": "apache", "value": "apache" }, "datasource": null, "includeAll": false, "multi": false, "multiFormat": "glob", "name": "app", "options": [ { "selected": true, "text": "tomcat", "value": "tomcat" }, { "selected": false, "text": "cassandra", "value": "cassandra" } ], "query": "tag_values(cpu.utilization.average,app)", "refresh": false, "regex": "", "type": "query" } ] }
The following table describes the usage of the templating fields.
Name | Usage |
---|---|
|
whether templating is enabled or not |
|
an array of objects each representing one template variable |
|
format to use while fetching all values from data source,
including |
|
shows current selected variable text/value on the dashboard |
|
shows data source for the variables |
|
whether all value option is available or not |
|
whether multiple values can be selected or not from variable value list |
|
format to use while fetching timeseries from data source |
|
name of variable |
|
array of variable text/value pairs available for selection on dashboard |
|
data source query used to fetch values for a variable |
|
configures when to refresh a variable |
|
extracts part of a series name or metric node segment |
|
type of variable, |