一、字典与JOSN相互转换
import json if __name__ == '__main__': json_str = '{"latitude": "121.04925573429551", "tel": "13675480983", "longitude": "31.315590522490712"}' dict_object = {'latitude': '121.04925573429551', 'tel': '13675480983', 'longitude': '31.315590522490712'} print('JSON字符串 转 字典: {}'.format(json.loads(json_str))) print('字典 转 JSON字符串: {}'.format(json.dumps(json_str)))
输出: