2013-10-15 66 views
1

無論如何從JSON字符串創建Java POJO模板?我使用的是新澤西州如何將JSON轉換爲POJO

{ 
    "reviewData" : [ { 
    "projectKey" : "CR-FOO", 
    "name" : "Example review.", 
    "description" : "Description or statement of objectives for this example review.", 
    "author" : { 
     "userName" : "joe", 
     "displayName" : "Joe Krustofski", 
     "avatarUrl" : "http://foo.com/avatar" 
    }, 
    "moderator" : { 
     "userName" : "scott", 
     "displayName" : "Scott the Moderator", 
     "avatarUrl" : "http://foo.com/avatar" 
    }, 
    "creator" : { 
     "userName" : "joe", 
     "displayName" : "Joe Krustofski", 
     "avatarUrl" : "http://foo.com/avatar" 
    }, 
    "permaId" : { 
     "id" : "CR-FOO-21" 
    }, 
    "permaIdHistory" : [ "CR-FOO-21" ], 
    "type" : "REVIEW", 
    "allowReviewersToJoin" : true, 
    "metricsVersion" : 4, 
    "createDate" : "2013-10-08T15:46:11.022+0200", 
    "dueDate" : "2013-10-09T15:46:11.022+0200", 
    "jiraIssueKey" : "FOO-6754" 
    }, { 
    "projectKey" : "CR-FOO", 
    "name" : "Example review.", 
    "description" : "Description or statement of objectives for this example review.", 
    "author" : { 
     "userName" : "joe", 
     "displayName" : "Joe Krustofski", 
     "avatarUrl" : "http://foo.com/avatar" 
    }, 
    "moderator" : { 
     "userName" : "scott", 
     "displayName" : "Scott the Moderator", 
     "avatarUrl" : "http://foo.com/avatar" 
    }, 
    "creator" : { 
     "userName" : "joe", 
     "displayName" : "Joe Krustofski", 
     "avatarUrl" : "http://foo.com/avatar" 
    }, 
    "permaId" : { 
     "id" : "CR-FOO-21" 
    }, 
    "permaIdHistory" : [ "CR-FOO-21" ], 
    "type" : "REVIEW", 
    "allowReviewersToJoin" : true, 
    "metricsVersion" : 4, 
    "createDate" : "2013-10-08T15:46:11.022+0200", 
    "dueDate" : "2013-10-09T15:46:11.022+0200", 
    "jiraIssueKey" : "FOO-6754" 
    } ] 
} 
+0

找到答案 http://stackoverflow.com/questions/1957406/generate-java-class-from-json – DarVar

回答