Python Convert JSON to Python Object

You can unpack values of each dict to LegoGame constructor:

import json
...
with open(filename) as f:
    lst = json.load(f)

result = [LegoTheme(*obj.values()) for obj in lst]

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top