so I have an Item class which looks like this(extra stuff excluded):
{
"id": 1,
"item": "something",
"account": {
"id": 5,
"name": "somename"
}
}
I want the owner tap to appear for example like this
{
"id": 1,
"item": "something",
"account": "somename"
}
I know how to do this by changing the way Item is serialized in Jackson, however if I am to change the way I serialize Item, I will have to include all the extra fields it has, also Item is a base class so I have to do something with all the child classes as well, which is too much work (or is it, dunno if anyone has an easy solution how to serialize just one field and include all the rest). So my question is can I just serialize the Account class and make it return a simple String (not a json object or anything like that). I've tried working around with the JsonGenerator to make it look similar but the best I've got to so far is:
{
"id": 1,
"item": "something",
"account": {"account":"somename"}
}
Thanks!