Hyrrokkin icon indicating copy to clipboard operation
Hyrrokkin copied to clipboard

Deserializer

Open miguelcobain opened this issue 10 years ago • 1 comments

Is any deserializer planned? How can we handle the task of handling the requests from Ember Data?

My main problem is how do we handle associations.

Let's say we have a POST:

{
   "user":{
      "roles":[1,2,3,4]
   }
}

and

public class User {
    List<Role> roles;
}

What would be the equivalent instance in Java? Creating Role instances within a User instance, with only the their id set? Seems the most sensible approach.

miguelcobain avatar Jan 27 '15 16:01 miguelcobain

I am working on a deserialiser, but I haven't got one up to commit-quality as of yet. The problem is, as you say, with associations.

I think the best viable option is to do the opposite of the serialiser, meaning to take the flat structure of the JSON and build a hierarchical instead.

Then once this structure is OK, a simple new Gson().fromJson(jsonString, MyClass.class) would suffice (in an internal private method inside Hyrrokkin)

Hashtables all the way :)

joachimhs avatar Jan 30 '15 08:01 joachimhs