Less logic and fewer lines:
```python
g.json.pop("start", None)
g.json.pop("end", None)
```