2016-01-27 64 views
-2

我想知道我是怎麼做使用改造後的發送服務器列表的列表,其結果是這樣的:後使用改裝

{ 
    "facebookProfile":{ 
    "name":"String", 
    "education_history":"String", 
    "birthday":"String", 
    "hometown":"String", 
    "email":"String", 
    "location":"String" 
}, 
    "picture":{ 
    "selfieURL":"String", 
    "documentIDs":{ 
     "frontURL":"String", 
     "backURL":"String" 
     } 
} 
} 

IDVerification -

public class IDVerification { 

    private FacebookProfile facebookProfile; 

    private Customer customer; 

    private Location location; 

    private Picture picture; 

    private Audio audio; 
} 

FacebookProfile - (有gatter和setter)

public class FacebookProfile implements Serializable{ 

    private String name; 

    private String education_history; 

    private String birthday; 

    private String hometown; 

    private String email; 

    private String location; 
} 

圖片 - (有getter和setter)

public class Picture implements Serializable{ 

    private String selfieURL; 

    private DocumentIDs documentIDs; 
} 
+0

你嘗試了什麼樣的wxactly?這非常簡單 - 定義一個代表響應對象的類,它將從你的轉換器(即'Gson')的'json'解析出來。 – gilgil28

+0

我需要創建一個帖子來發送一組信息,服務器類似於上面的東西 –

回答

0

定義以下類: FacebookProfileCustomerLocationDocumentIDsPictureAudio 和定義它們的屬性,getter和setter。 Picture看起來如下:

public class Picture { 

    private String selfieURL; 
    private DocumentIDs documentIDs; 


    public String getSelfieURL() { 
     return selfieURL; 
    } 


    public void setSelfieURL(String selfieURL) { 
     this.selfieURL = selfieURL; 
    } 


    public DocumentIDs getDocumentIDs() { 
     return documentIDs; 
    } 


    public void setDocumentIDs(DocumentIDs documentIDs) { 
     this.documentIDs = documentIDs; 
    } 

}