I have a string:
A = "{user_id:34dd833,category:secondary,items:camera,type:sg_ser}"
I need to convert it to python dictionary, so that:
A = {"user_id":34dd833"34dd833", "category": "secondary", "items": "camera", "type": "sg_ser"}
On top of that, there are two more issues:
1: the "items" key is supposed to have multiple values, like:
A = {"user_id":34dd833, "category": "secondary", "items": "camera,vcr,dvd", "type": "sg_ser"}
Which apparently comes into the form of a string as:
A = "{user_id:34dd833,category:secondary,items:camera,vcr,dvd,type:sg_ser}"
So, generalizing anything based on comma separation becomes useless.
2: The order of the string can be random as well. So, the string can be like this as well:
A = "{category:secondary,type:sg_ser,user_id:34dd833,items:camera,vcr,dvd}"
Which makes any the process of assuming thins by order as a false one.
What to do in such a situation? Many thanks.