Add compare, json encoding, and repr()

Convenience functions
> perhaps just return self.termJSONEncoder()?

Thanks - good idea. Changed.