I have a variable `edge = Edge1(__typename=CmsCaro...
# announcements
c
I have a variable
edge = Edge1(__typename=CmsCarouselImageEdge, .....)
and I would like to define my own data class
data class MyClass
rather than return this variable as
Edge1
. how do I do it in Kotlin?
Copy code
val my_data: MyClass = edge as MyClass
m
I'm not sure what you want @Chung. Do you own the Edge class?
c
No, it is an response from a http response, and I would like to put the data into a new class so that I don't expose)return the third party class
m
Then I think you're stuck at a raw copy over from the original class.
c
in my head I have this idea val data = edge.toJson() val n = MyClass.from(data) then I have the data passed to the class I defined