TypeError: ObjectId(”) is not JSON serializable

Pymongo provides json_util – you can use that one instead to handle BSON types

def parse_json(data):
    return json.loads(json_util.dumps(data))

Leave a Comment