I have a 5 columns named id, name, salary. dept in postgres DB.
I am fetching all the values of the columns & storing into a json file. But the problem i am getting is i am not able to store the values w.r.t the keys that means column name are the keys. I want to store the values as column name as key.
I tried with:
curser.execute(select id,name,salary, dept from employee)
record = curser.fetchall()
Here record is in the form of list. i want something like this below:
    {
    "id":"1"
    "name":[{"first":"abc"},{"last":xyz}]
    likewise others
}
  but i am getting like:
    {
    1
    [{"first":"abc"},{"last":xyz}]
}
can someone see the problem. If anyth other clarification need then feel free to ask me.Thanks in advance
 {
        "guid": "9c36adc1-7fb5-4d5b-83b4-90356a46061a",
        "name": "Angela Barton",
        "is_active": true,
        "company": "Magnafone",
        "address": "178 Howard Place, Gulf, Washington, 702",
        "registered": "2009-11-07T08:53:22 +08:00",
        "latitude": 19.793713,
        "longitude": 86.513373,
        "tags": [
            "enim",
            "aliquip",
            "qui"
        ]
    }
But i need like:
    { 
details:{
        "guid": "9c36adc1-7fb5-4d5b-83b4-90356a46061a",
        "name": "Angela Barton",
        "is_active": true,
        "company": "Magnafone",
        "address": "178 Howard Place, Gulf, Washington, 702",
        "registered": "2009-11-07T08:53:22 +08:00",
        "latitude": 19.793713,
        "longitude": 86.513373}
        "tags": [
            "enim",
            "aliquip",
            "qui"
        ]
    }
Here details is the columns.
