A
A
Alexey Belov2018-09-15 21:14:01
Python
Alexey Belov, 2018-09-15 21:14:01

Python how to replace list in json?

I have such a date
{'trainings': [словарь]
When data['trainings'] = [more than other dictionaries], a double bracket is added
{'trainings': "[больше других словарей]"
What destroys the whole structure, how to avoid this? Take elements from the dictionary and somehow append the list?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Tikhonov, 2018-09-16
@Alenorze

>>> import json
>>> a = {"trainings": [{"more": "dicts"}, {"and": "even_more"}]}
>>> json.dumps(a)
'{"trainings": [{"more": "dicts"}, {"and": "even_more"}]}'
>>>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question