删除新行分隔的json中的键



我有一个巨大的json文件,看起来像这样:

{"_id": "60ddad", "type": ["test"], "company": ["60dd888"], "answers": [], "info": {}, "createdAt": "2021-07-01T11:57:08.492Z","__v": 0}
{"_id": "60deb", "type": ["test"], "company": ["60dea"], "answers": [], "info": {}, "createdAt": "2021-07-02T07:07:27.436Z","__v": 0, "sentence": {}, "text": {}}
{"_id": "60debb2", "type": ["exam"], "company": ["60dea"], "answers": ["option1"], "info": {}, "createdAt": "2021-07-02T07:07:27.451Z", "__v": 0, "sentence": {}, "text": {}}

当试图将其上传到BigQuery表时,它告诉我它不支持空的结构类型("文本"(。所以我想简单地删除空的结构类型。

  1. 它只是";文本";或者";信息";以及";句子";在这种情况下
  2. 如何删除所有名为";文本"信息"句子";如果每一个元素都在一条新的线上

加载.json文件;移除空的structs;将生成的对象以JSON的形式保存回文件中。

最新更新