Loading and parsing a JSON file with multiple JSON objects

前端 未结 3 1629
醉话见心
醉话见心 2020-11-22 09:40

I am trying to load and parse a JSON file in Python. But I\'m stuck trying to load the file:

import json
json_data = open(\'file\')
data = json.load(json_dat         


        
3条回答
  •  粉色の甜心
    2020-11-22 10:36

    for those stumbling upon this question: the python jsonlines library (much younger than this question) elegantly handles files with one json document per line. see https://jsonlines.readthedocs.io/

提交回复
热议问题