Answer the question
In order to leave comments, you need to log in
Error while converting json file to json string, python, what's the problem?
I have a json file which I am trying to convert to a string:
def open_file(file_name):
"""Функция открытия json файла и его десериализация"""
with open(file_name, "r", encoding='utf-8-sig') as f:
data = json.loads(f.read())
return data
Answer the question
In order to leave comments, you need to log in
Remove the first and last curly brackets - and everything will work.
The curly braces imply that they contain a key=value. And there you have an array stuck in instead.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question