I want to sort by the 'idx' value in the following dictionary, to create a list of dictionaries
episodes = { u '70303660': { u 'title': u 'The Forbidden Feast', u 'synopsis': u 'Caster and Uryu discuss their views on God, resulting in plans for a horrifying attack -- one that requires everyone else to unite against Caster.', u 'summary': { u 'notStreaming': False, u 'isOriginal': False, u 'season': 1, u 'idx': 13, u '$type': u 'leaf', u 'type': u 'episode' }, }, u '70303654': { u 'title': u 'Dark Forest', u 'synopsis': u 'The battle is on hold as the group decides what to do about Ryunosuke Uryu and his servant, Caster, who have been kidnapping and sacrificing children.', u 'summary': { u 'notStreaming': False, u 'isOriginal': False, u 'season': 1, u 'idx': 7, u '$type': u 'leaf', u 'type': u 'episode' }, }, } So far I have tried:
sorted(episodes, lambda x: x['summary']['idx'])