Hello, I'm working with a protocol that serializes...
# serialization
l
Hello, I'm working with a protocol that serializes fields as the indices of an array. For example
Copy code
{
  "type": 1,
  "realm": "dev"
}
would actually be serialized as
Copy code
[1, "dev"]
and I'm not too sure how to go about this. I was going to go with a message hierarchy and then delegate to the specific serializer based off the type, which I've successfully done before with the first JSON example. Though, I'm not sure how to do that with the second example, nor how to even (de)serialize the second example into a class that would look like this.
Copy code
data class Foo(val type: Int, val realm: String)
It'd be nice to know if this is even possible, since I'm completely stumped on how to create a proper descriptor for the second situation. Thanks.
seems like i can just use the JsonArray descriptor and work fairly easily with that. yup i can serialize and deserialize just fine using a combination of transforming and polymorphic serializers working on json arrays