Reworking json encoding to support simple objects as well as complex lists, dicts, and datetimes