简体   繁体   中英

Is there a way to remove a json key/value using python and simplejson/json

正如标题所说,我希望去除特定键的 json,这是否可以将 json 或 simplejson 与 python 一起使用?

json 将加载到 python dict 中,因此您可以通过字典理解将它们剥离:

{k:v for k,v in json.loads(string_where_json_was_readed) if k not in keys_to_strip_list}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM