Mysql Datasouce in Dashboard panel json from API has no type


I was trying to get dashboard json by api and handle it by code. But I found my panel with mysql datasouce they dont have stand datasouce structure like

datasouce: {

but only the name string in datasouce field like

datasouce: 'mysql-a'.
This only happens when getting datasouce json by API. If I use the web page to check the json model of the same dashboard, I can see the datasouce structure as normal 
"datasource": {
        "type": "mysql",
        "uid": "xxxxxxx"

My expectation is to get the stand datasouce structure no matter getting from web or API.