3

I have json file but this file have weight 186 mb. I try read via python .

import json
f = open('file.json','r')
r = json.loads(f.read())

ValueError: Extra data: line 88 column 2 -...

FILE

How to open it? Help me

1
  • 1
    Your JSON file appears to be invalid. Commented Apr 5, 2018 at 9:16

2 Answers 2

3

Your JSON file isn't a JSON file, it's several JSON files mashed together.

The first instance of this occurs in the 1630070th character:

'шова"}]}]}{"response":[{"count'
           ^ here

That said, jq appears to be able to handle it, so the individual parts are fine.

You'll need to split the file at the boundaries of the individual JSON objects. Try catching the JSONDecodeError and use its .colno to slice the text into correct chunks.

Sign up to request clarification or add additional context in comments.

Comments

1

It should be:

r = json.loads(f)

Comments