I have such attribute in my element:
data-variations="{"2005":"11.99","2006":"15.99","2007":"19.99"}"
Is there any way to convert it into an object, which can look like:
obj = {2005:11.99, 2006:15.99, 2007:19.99}
I've tried first to get this attribute as string and split it with "," for further manipulations, but realized that there must be better and cleaner solution
datamethod automatically parses attribute values that contain JSON. The only thing you'd have to do is iterate over the object and convert the values to numbers (or of course simply store them as numbers in the first place).