Delete Objects From A Json File Using A Key Obtained From A List Of Strings In Python
I have a json in the following format: Im trying to remove any duplicates/older versions of the json object based on the id field (ie. the object with id=Some_ID_01 and id=Some_ID
Solution 1:
You're getting an error because pop
expects an index, not an object.
However, that's somewhat irrelevant since it's a bad idea to modify a list that you're iterating over.
I'd consider just using a list comprehension; something like good_features = [i for i in json_data['feature'] if i['id'] not in IDList]
Post a Comment for "Delete Objects From A Json File Using A Key Obtained From A List Of Strings In Python"