Python
1json_file = open('a.json') 2 3json_dict = json.load(json_file)
a.json
1{ 2 "name": "aaa", 3 "id": "aaaaa" 4}{ 5 "name": "bbb", 6 "id": "bbbbb" 7}
error
1JSONDecodeError Traceback (most recent call last) 2/tmp/ipykernel_61880/3946298941.py in <module> 3 7 json_file = open('a.json') 4 8 5----> 9 json_dict = json.load(json_file) 6 10 7 11 get_data = json_dict["age"] 8 9~/anaconda3/lib/python3.9/json/__init__.py in load(fp, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 10 291 kwarg; otherwise ``JSONDecoder`` is used. 11 292 """ 12--> 293 return loads(fp.read(), 13 294 cls=cls, object_hook=object_hook, 14 295 parse_float=parse_float, parse_int=parse_int, 15 16~/anaconda3/lib/python3.9/json/__init__.py in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 17 344 parse_int is None and parse_float is None and 18 345 parse_constant is None and object_pairs_hook is None and not kw): 19--> 346 return _default_decoder.decode(s) 20 347 if cls is None: 21 348 cls = JSONDecoder 22 23~/anaconda3/lib/python3.9/json/decoder.py in decode(self, s, _w) 24 338 end = _w(s, end).end() 25 339 if end != len(s): 26--> 340 raise JSONDecodeError("Extra data", s, end) 27 341 return obj 28 342 29 30JSONDecodeError: Extra data: line 4 column 2 (char 67)
読み込めるようにしたいです
お願いします
a.json は JSON 形式としては不適合な内容ですので、それを修正する方がよいかと思いますが…。

回答2件
あなたの回答
tips
プレビュー