2013-09-25 39 views
1

我應該如何解組匿名數組格式的json輸入。我嘗試了以下,但將對象字段設置爲null。請注意,這不是完整的代碼,解組記錄是在單獨的json綁定上正常工作。eclipselink moxy json匿名數組的外部綁定

的Json輸入:

{ 
records:[ [1,"test"], [2,"test2"]] 
} 

解組到對象使用數組元素使用外部結合

{ 
    "package-name": "com.model", 
    "xmlns" : "http://www.eclipse.org/eclipselink/xsds/persistence/oxm", 
    "version" : "2.1", 
    "java-types" : { 
     "java-type" : [ { 
     "name" : "WeekBox", 
     "xml-root-element" : {}, 
     "java-attributes" : { 
      "xml-element" : [ 
       {"java-attribute" : "id" , "xml-path" : "[0]/text()"}, 
       {"java-attribute" : "title" , "xml-path" : "[1]/text()"} 
      ] 
     } 
     } ] 
    } 
} 

模型對象:

public class WeekBox { 
private Integer id; 
private String title; 
... 
} 

回答

相關問題