I have the data coming as a API which is in a string format And the data is exactly like list of dictionaries
'{'key1':'value','key2':'value','key3':'value'},{'key1':'value','key2':'value','key3':'value'},...'
Is their any way I can convert this string to a list of dictionary?
ast.literal_eval
should do the trick:
from ast import literal_eval
result = literal_eval(my_string)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments