python json dump

    [Python] json 데이터 다루기

    json 읽어오기 (json -> dict) import json # json 파일 읽어오기 with open('./test.json', 'r', encoding='UTF8') as json_file: sample_json = json.load(json_file) print(sample_json) # 출력: {'이름': '홍길동', '나이': 25, '특기': ['농구', '도술'], '가족관계': {'아버지': '홍판서', '어머니': '춘섬'}, '결혼 여부': True} # json 문자열 읽어오기 json_str = ''' { "이름": "홍길동", "나이": 25, "특기": ["농구", "도술"], "가족관계": { "아버지": "홍판서", "어머니": "춘섬" }, "결혼 여부": true ..