If an object has a __json__ method, use it when encoding.

It should return a raw JSON string which will be directly included in
the resulting JSON when encoding.