guillaumeoriol/serquant — Issue #14: add a identifier prefix feature to the serializer
Author: guillaumeoriol
Created: 2011-11-16 09:38:50+00:00
State: open
Labels: enhancement

When data is serialized to JSON before beeing sent to the client, no type information is given. For instance, in the following code:

{
"id": "1240",
"name": "Dupont",
"address": {
"id": "9571",
"postalCode": "77400",
"city": "Lagny-sur-Marne"
}
}

we don't know the object class having *id*, *name* and *address* properties or the one having *id*, *postalCode* and *city*.
Thus, the client receiving this data is unable to handle it properly (ie populate the dojo store in our situation).

If we serialize the same data with an identifier prefix, the JSON becomes:

{
"id": "/person/1240",
"name": "Dupont",
"address": {
"id": "/address/9571",
"postalCode": "77400",
"city": "Lagny-sur-Marne"
}
}

permitting the client to distinguish object classes from each others.

Therefore, we need a way to add a prefix on serialization and remove it on deserialization.