I am creating apis in python flask. I am using MySQL for database and got data successfully using SELECT query. I have returned the data in json format using jsonify of flask. What i want to ask is, I am getting json in following format after jsonify that uses integer as index
[
[
1,
"FURNITURE",
"INDOOR FURNITURE"
],
[
2,
"AUTOMOBILES",
"CARS, BIKES"
],
[
3,
"LAPTOP & ACCESSORIES",
"LAPTOP, MOUSE, KEY BOARD, PENDRIVE"
]
]
It is fine and i can work with this but I am looking for json that has database table attribute as its index like we can get in nodejs so it will be easier to work in font end. I want to have json in following format where index are my database table column name.
[
{ "CATEGORY_ID":1,
"CATEGORY_NAME":"FURNITURE",
"DESCRIPTION":"INDOOR FURNITURE"
},
{ "CATEGORY_ID":2,
"CATEGORY_NAME":"AUTOMOBILES",
"DESCRIPTION":"CARS, BIKES"
},
{ "CATEGORY_ID":3,
"CATEGORY_NAME":"LAPTOP & ACCESSORIES",
"DESCRIPTION":"LAPTOP, MOUSE, KEY BOARD, PENDRIVE"
}
]