How to put JSon Objects into a python dict


I have a JSon object as below:

    "Type": ["Alpha",

What I want to do is loop through the object ‘Type’ and print each element out separately and store it as Type1 and Type2 in Python but cannot figure out how to.

I am doing the below:

    for differentTypes in Types:
        if (differentTypes.key == "type"):
            options[differntTypes.key] = differentTypes.value

If I print out just options dict it prints out all the elements in the dict and if I print out the options with given element i.e. [0] it will print out first character of first type e.g., “

I do not want to have to specify the element to print out and want it to print out all different elements, and by elements I mean the whole world in this case Type1 would be Alpha and Type2 Beta.



Add a Comment