[Solved] Python: make list a json text but the list is invalid in this way


Don’t use list in this case

You need to use {key:value} like datatype in python you can use Dictionary Like:

import json

# some JSON:
x =  '{ "name":"John", "age":30, "city":"New York"}'

# parse x:
y = json.loads(x)

# the result is a Python dictionary:
print(y)

It will done by using json library in python

For more information read docs and check https://realpython.com/python-json/

5

solved Python: make list a json text but the list is invalid in this way