Support the TwoElemArray and ObjectWithType sum encodings in gToJSON