Grafana dashboard json model differs from the actual dashboard model

  • What Grafana version and what operating system are you using?
    v9.0.5, Linux

  • What are you trying to achieve?
    I have 2 dashboards that include 2 variables, I want to use API to get the dashboard and get those variables listed.

  • How are you trying to achieve it?
    created one token to hit the HTTP API or can just check the JSON model in the settings.

  • What happened?
    I can see that when I go to JSON model for the given sections, inside templating for a given variable its currently selected value is present but the options are empty even though it’s visible on the UI. sometimes, the currently selected value is also wrong. is it intended or am I seeing the initial structure? doesn’t it get updated automatically?

  • What did you expect to happen?
    the json should reflect what’s visible on the UI.

  • Can you copy/paste the configuration(s) that you are having problems with?

  "templating": {
            "list": [
                {
                    "current": {
                        "selected": true,
                        "text": "cpaas",
                        "value": "cpaas"
                    },
                    "hide": 0,
                    "includeAll": false,
                    "label": "Data Source",
                    "multi": false,
                    "name": "ds",
                    "options": [],
                    "query": "prometheus",
                    "queryValue": "",
                    "refresh": 1,
                    "regex": "",
                    "skipUrlSync": false,
                    "type": "datasource"
                },