I am having my User class annotated like this to remove cyclic format of output:
@Entity
@Table(name = "USER")
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id", scope = User.class)
public class User extends AbstractValueObject {
private Integer id;
private String name;
.....
}
public class Load extends AbstractValueObject {
private Integer id;
private User postedBy;
}
So whenever i fetch List of Load it is giving me output as below JSON :
[
{
"id" : 1,
"postedBy" : {
"id":1,
"name":"SOF"
}
},
{
"id" : 2,
"postedBy" : 1
}
]
But client side wants it in original format - say each object of load should contain full postedBy object. Client side is in Android - Java.
Is there any way at Android end to de-serialize object in original format at Android ?
Expected output :
[
{
"id" : 1,
"postedBy" : {
"id":1,
"name":"SOF"
}
},
{
"id" : 2,
"postedBy" : {
"id":1,
"name":"SOF"
}
}
]
I tried with JSOG but in some cases it fails.
Any help will be appreciated. :)
You can use Jsog Converter, which provide library to encode and decode objects. https://github.com/jsog/jsog
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With