fork download
  1. data = {
  2. "acc_id": "AAA",
  3. "cont_id": "CCC",
  4. "location": [
  5. {
  6. "x": 123,
  7. "y": 323,
  8. "z": 444
  9. },
  10. {
  11. "x": 123,
  12. "y": 323,
  13. "z": 444
  14. },
  15. {
  16. "x": 123,
  17. "y": 323,
  18. "z": 444
  19. }
  20. ]
  21. }
  22. data['location'] = list(map(dict, {frozenset(d.items()) for d in data['location']}))
  23. print(data)
Success #stdin #stdout 0.03s 9640KB
stdin
Standard input is empty
stdout
{'acc_id': 'AAA', 'cont_id': 'CCC', 'location': [{'y': 323, 'z': 444, 'x': 123}]}