#1.conclusion:there are 2 solutions to get the data from database #(1) 1st solution: use pandas library to get the df(data frame) from databse #(2) 2nd solution: use json library to get the dict from json databse #2.json:important libray for transfer dict into json import json #3.transfer the dict into json(method: json.dumps()) d1 = {"john":"0912852963","peter":"0974123456","tom":"0985742951","marry":"0963852456"} j1 = json.dumps(d1) print('d1=',d1) print('j1=',j1) #4.transfer the list data into json l1 = [["john","0912852963"],["peter","0974123456"],["tom","0985742951"],["marry","0963852456"]] # transfer list into dict d1 = dict(l1) # tranfer dict into json j1 = json.dumps(d1) print("") print('l1=',l1) print('d1=',d1) print('j1=',j1) #5.transfer json into dict d1 = json.loads(j1) print("") print('d1=',d1) print('tel of tom=',d1['tom'])