I am using FlexJson to support my entities with JSON.
But I do have some problems deserializing them, because I want a "short data amount" to reduce the data volume sent between backend and client.
Lets suggest we do have a Person class which references to an address:
public class Person {
private String firstname;
private String surname;
private Address address;
}
So what I now want is, to deserialize an Person object containing just the address id and loading the address via this id from the database.
{
"firstname":"Michael",
"surname":"Blomkvist",
"addressid":"1"
}
Any suggestions how to tell this the JSONDeserializer?
I tried to add a use("addressid", new MyCustomAddressObjectFactory()) but it never gets called.
I would appreciate any help!
Thanks in advance!
来源:https://stackoverflow.com/questions/7792156/flexjson-deserialization-with-custom-objectfactories