borra_duplicados.py 459 B

123456789101112131415
  1. import json
  2. # Read the JSON file
  3. with open('ff.json', 'r') as file:
  4. data = json.load(file)
  5. # Convert the list of dictionaries into a set of tuples
  6. unique_objects = set(tuple(obj.items()) for obj in data)
  7. # Convert the set of tuples back into a list of dictionaries
  8. filtered_data = [dict(obj) for obj in unique_objects]
  9. # Write the filtered data to a new JSON file
  10. with open('ff-limpio.json', 'w') as file:
  11. json.dump(filtered_data, file, indent=2)