Arun Sudharsan
01/17/2023, 4:41 PMdata class Content( val aName: String, val bName: String)
This is the type how a library is sending the data to the app.
I need to send this to our backend which requires the keys to be like
“a_name” and “b_name” so I tagged the Json(name=“”) annotations on top of them like this,
data class Content( @Json(name="a_name") val aName: String, @Json(name="b_name") val bName: String)
But now the library is shouting with the below error:
com.squareup.moshi.JsonDataException: Required value ‘aName’ (JSON name ‘a_name’) missing at $[1]
My Solution is to create LibraryContent
data class and BackendContent
data class with the respective names. Is there a better solution? Thanks in advance!Chris Lee
01/17/2023, 4:58 PMArun Sudharsan
01/17/2023, 5:02 PMArun Sudharsan
01/17/2023, 5:02 PMArun Sudharsan
01/17/2023, 5:02 PMChris Lee
01/17/2023, 5:33 PMChris Lee
01/17/2023, 5:33 PMCiaran Sloan
01/17/2023, 6:24 PMContentLibraryModel
ContentApiModel
Arun Sudharsan
01/18/2023, 5:55 AM