How to set a class to value if that class is declared as a string?

Lets say I have arrays with data that will be added to a dictionary like the examples below,

# Element 1
["variant", "hiveCrate", "String"]

# Element 2
["flag", "2", "int"]

# Element 3
["scale", "1.2", "float"]

Index 0 represents the key of the dictionary
Index 1 represents the value of that key
Index 2 represents the class of that value

Which would give an output like so :

{
  "variant": "hiveCrate",
  "flag": 2,
  "scale": 1.2,
}

So far I did something like

dict[dataSet[0]] = dataSet[1]

But I have no idea how to properly set the class for each value, what would be the best way to solve this?

Unfortunately dictionaries can’t be typed.

I would consider an inner class over a dictionary, but I don’t know your goals with this data organization

1 Like

Never worked with inner classes before but ill look into it!!! Thanks for the reply!!!