Sort Json List From Another List August 06, 2024 Post a Comment I'm trying to sort a json list from another list. example: jsonList = [{'id': 'das', 'name': 'something'}, {'id': 'rtn', 'name': 'Something Else'}, {'id': 'ddsn', 'name': 'SomethinSolution 1: goodList = sorted(jsonList, key=lambda x: orderList.index(x['id']))or if you want just sort by idsorted(jsonList, key=lambda x : x['id']) Share Post a Comment for "Sort Json List From Another List"
Post a Comment for "Sort Json List From Another List"