I am working with database that does not support json documents in relational tables.
I am storing small lists like a=[1,2,3]
as string b=str(a)
.
As a result, I have b='[1, 2, 3]'
. After fetching this string from database, I want to convert it back to list.
Is there a generic python function that does the correct conversion? Calling c=list(b)
results in c=['[', '1', ',', ' ', '2', ',', ' ', '3', ']']
.
My list entries can be integer numbers (including negative), floats (with up to 5 digits after coma), and short strings.
Thanks, Mikhail