Announcement Announcement Module
Collapse
No announcement yet.
REST Web Service - JSON with $ref node Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • REST Web Service - JSON with $ref node

    Hello all,

    I'm doing a client implementation of a REST service on Spring Framework 3.2 with Jackson 2.1.3.

    Until now i could solve all the problems either by recurring to this forum or in Jackson specification. The problem began when an update to the server implementation was done in order to shring (even more ) the json message size. They began to use object references to duplicated entries in arrays. I will post a simple example of the following message format was used:
    [{"$id":"1","Name":"X"},
    {"$id":"2","Name":"Y"},
    {"$id":"3","Name":"Z"},
    {"$ref":"1"}]

    Consider the data model as the following:
    @JsonIdentityInfo(generator=ObjectIdGenerators.Int SequenceGenerator.class, property="$id")
    public class TypeW implements ITypeW {

    @JsonProperty(required=true, value="Name")
    protected String name;
    }
    I've seen examples of this working without that "$ref" entry and I'm wondering if I can customize or implement a specific deserializer in order to achieve the same result with the format that I've posted above.
    Last edited by ricardo.leal; Jan 28th, 2013, 02:16 PM. Reason: tipo
Working...
X