Hick
Hick

Reputation: 36394

What would be the corresponding object hierarchy for this?

I was doing Json parsing. As of now, I was reading it from a file and then using a JSON parser on it. Then I came across Google Gson. Where, I've to create a class wrapper. A bit confused as to what the class wrapper would be for my JSON data that I've shown down there. Any help?

{"contact":
{
  "id":""
  "pod":""
  "user":"",
  "contactType" : [

   {"user": "",
    "pod" : ""
    }
  ]
  "conversation":[

    {
    "id":""
    "subject":""
    "crumb":""
    "message":  [
            {
            "id":""
            "body":"    "
            "time":""
        }
    ]
    "time":""
    }
    ]
}

}

Upvotes: 0

Views: 64

Answers (1)

aacanakin
aacanakin

Reputation: 2913

Contact object has the following variables & objects;

id; // variable
pod; // variable
user; // variable
contactType() // object with following fields
    user; // variable
    pod;  // variable
conversation() // object with following fields
    id; // variable 
    subject; // variable
    crumb; // variable
    time;  // variable
    message() // object with following fields
        id; // variable
        body; // variable
        time; // variable

I suppose this is the right object hierarchy of you wrapper class

Upvotes: 1

Related Questions