0

This is the code that I have been trying:

import ijson
import urllib.request

with urllib.request.urlopen(some_link) as read_file:
        path_array = ijson.items(read_file, object_in_json)

but I get this error:

(b'lexical error: invalid char in json text.\n                                       \x1f\x8b\x08                     (right here) ------^\n',)
sanford
  • 13
  • 2
  • It seems like an error on the file thet it's being read. Can you post all or a portion of it? It may also be a character encoding error. – Enrico Agrusti Aug 02 '22 at 15:21

1 Answers1

0

Probably links are not supported by that library.

I advice you to use the requests module. So install it launching pip install requests.

Then, in your .py file:

import requests
response = requests.get(url)
json = response.json()