Python json.loads shows ValueError: Extra data

后端 未结 9 933
甜味超标
甜味超标 2020-11-22 16:21

I am getting some data from a JSON file \"new.json\", and I want to filter some data and store it into a new JSON file. Here is my code:

import json
with ope         


        
9条回答
  •  佛祖请我去吃肉
    2020-11-22 16:58

    Well , it might help someone. i just got the same error while my json file is like this

    {"id":"1101010","city_id":"1101","name":"TEUPAH SELATAN"}
    {"id":"1101020","city_id":"1101","name":"SIMEULUE TIMUR"}
    

    and i found it malformed, so i changed it into somekind of

    {
      "datas":[
        {"id":"1101010","city_id":"1101","name":"TEUPAH SELATAN"},
        {"id":"1101020","city_id":"1101","name":"SIMEULUE TIMUR"}
      ]
    }
    

提交回复
热议问题