Removing JSON property in array of objects

前端 未结 4 1286
鱼传尺愫
鱼传尺愫 2020-12-09 09:26

I have a JSON array that I\'m cleaning up in Python. I want to remove the imageData property:

data.json

[{\"title\": \"         


        
4条回答
  •  春和景丽
    2020-12-09 09:58

    [ item for item in data if not item['imageData'] ]
    

    is empty becaus all have imageData. You are just testing for it, not removing it.

    Loop over date and del item['imageData'] on each item.

提交回复
热议问题