I have a json file that is 2 GB, and when I try to load it I'm getting this error:
json.decoder.JSONDecodeError: Unterminated string starting at: line 1 column 1093156512 (char 1093156511)
So this means that there is probably some escape sequence, right?(or something like that..) that is messing up the json correct? The issue is that this file is huge, and just opening it in the editor is a huge pain. The editor 100% crashes before I can see what the issue is. However, I still need to fix this issue somehow.... I'm not sure what can be causing this issue.... it can be many things.
my data is essentially a list of objects like so:
data = [{key1: 123, key2:"this is the first string to concatenate"},
{key1: 131, key2:"this is the second string to concatenate"},
{key1: 152, key2:"this is the third string to concatenate"} ]
Except with more complicated key2
's. If the issue was an \
, if I got rid of all of \
's within the json file would it work? However, there is nothing to say that an odd escape character is my issue.... also, I have very little control about what my input json file is, so I dont think I would be able to change that anyway.
Is there anyway to fix this issue without changing the input json file?
[EDIT] This is the whole error trace:
File "halp.py", line 38, in data = json.load(json_file,strict=False)
File "/usr/lib/python3.6/json/init.py", line 299, in load parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "/usr/lib/python3.6/json/init.py", line 367, in loads return cls(**kw).decode(s)
File "/usr/lib/python3.6/json/decoder.py", line 339, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.6/json/decoder.py", line 355, in raw_decode obj, end = self.scan_once(s, idx) json.decoder.JSONDecodeError: Unterminated string starting at: line 1 column 1093156512 (char 1093156511)
When I seek there I get:
eers in the fridge!"}, {"city_name": "Portland", "comments": "A cute space to rest your head in Portland. We just stayed for one night, briefly met Adam who was lovely! Appreciated the beers and coffe