2012-01-25 20 views
0

我在做Json解析。截至目前,我正在從一個文件中讀取它,然後在其上使用JSON解析器。然後我遇到了谷歌Gson。在哪裏,我必須創建一個類包裝器。對於我在那裏顯示的JSON數據的類包裝會有些困惑。 有什麼幫助嗎?這是什麼對應的對象層次?

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

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

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

} 
+0

是接觸 - >吊艙和非接觸>接觸類型 - >豆莢一樣的嗎? – aacanakin

+0

不,他們不是。 – Hick

回答

1

聯繫對象具有以下變量&對象;

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 

我想這是你正確的對象層次的包裝類