in running a very simple code:
with open(json_file) as anno_file:
anno = json.load(anno_file)
, an error:
json. The decoder. JSONDecodeError: Extra data: line 1 column 57054 char (57053)
Reason 2.
according to the prompt, the reason should be the json file of each line there is a limit to the number character (not more than 57053), but my line too much content
>
>
>
>
>
>
>
with open(file_write, "w+") as f:
for infor in dict_w[index]:
dict_w1 = {infor: dict_w[index][infor]}
json.dump(dict_w1, f)
f.write("\n")
4. Further problems
run again at the beginning of reading and an error while reading code:
json. The decoder. JSONDecodeError: Extra data: line 2 column 1 (135) char
on. Load does not support decoding multiple JSON objects: Json. Loads code>, and
json. The load code>) does not decode multiple json object.
https://stackoverflow.com/questions/21058935/python-json-loads-shows-valueerror-extra-data
to fill: What are the JSON objects?
6. The solution of the problem further
way 1: put the object in a list to write again, and then load.
but in my practice, such a line of words too much, there will be 1 mentioned to
problem 2: read line by line, and add a list
Read More:
- Docker load loading mirror message JSON no such file or directory error
- Error reading JSON file: json.decoder.JSONDecodeError : Extra data: line 6 column 2 (char 1329)
- Configuration file for vscode setting.json UI interface or JSON form
- Unable to read workspace file ‘D:\angular.json‘: Invalid JSON character: “ “ at
- 【ipfs-api】npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.
- Python json.dumps () json.dump The difference between ()
- To solve the problem of failed to load: data in HTML5 game running rmmv locally/ actors.json problem
- JSON data format net.sf.json .JSONException: A JSONObject text must begin with ‘{‘ at character 1 of Error:(f…
- [jQuery] jQuery operates on JSON strings or JSON objects
- R load(xxx.Rdata) Error bad restore file magic number (file may be corrupted) — no data loaded
- Unit Android converts c# class to JSON file and reports an error
- Local workspace file (‘angular.json’) could not be found.
- User defined profile in vscode settings.json And default configuration defaultSettings.json
- [unable to read project file xxxxx, XXX failed to load project file, name cannot start with “<" character (hex value 0x3c)] exception handling method
- Failed to load image from file “* * *. Png“
- Fatal Python error: initfsencoding: unable to load the file system codec
- Fatal Python error: Py_Initialize: unable to load the file system codec.
- Two solutions to Cannot load module file xxx.iml
- Cnpm: unable to load file
- failed to load resource file osql.rll