ankushg
08/31/2021, 11:36 PM{
"id": "file",
"value": "File",
"popup": {
"menuitem": [
{
"value": "New",
"onclick": "CreateDoc()"
},
{
"value": "Open",
"onclick": "OpenDoc()"
},
{
"value": "Save",
"onclick": "SaveDoc()"
}
]
}
}
I'd like to represent it with a data class Menu(val id: String, val value: String, val popup: String)
where the popup
subtree is stored as a String of valid JSON, instead of having to deserialize the whole nested popup
structure.
Happy to write a custom serializer for this because it doesn't happen too frequently in our codebase.ephemient
08/31/2021, 11:41 PMankushg
08/31/2021, 11:56 PMJsonElement
.
I'm OK with using JsonElement
behind the scenes, but still need the public API to be using String
.
Is this something a custom serializer could handle?ephemient
09/01/2021, 1:56 AMephemient
09/01/2021, 2:03 AMankushg
09/01/2021, 2:34 PMephemient
09/01/2021, 5:10 PMankushg
09/01/2021, 6:12 PM