Perhaps you could omit the `left` and `right` keys from leaf nodes. That would make the output more readable in the terminal, at the expense of a bit of code complexity.