I have a json which I would like to convert to PoJo and back. The format is like:
{
"name": "abc",
"othernames":{"x":"y", "z": 0}
}
Sometimes other instances are like:
{
"name": "abc",
"othernames":[{}]
}
How do I map this to a custom POJO class? I am finding the othernames
part which sometimes is a JsonObject
and some other times JsonArray
a bit tricky.
I tried MyCustomJsonAdapter
, but did not get far.