2013-01-24 15 views
0

來自Enunciate文檔模塊的示例JSON將地圖顯示爲對象數組。闡明示例JSON將地圖顯示爲陣列

舉例來說,我有一個對象,如:

@JsonRootType 
@JsonName("MyObj") 
@XmlRootElement 
public class MyObject { 
    @DocumentationExample("John Doe") 
    private String name; 
    private Map<String, String> attributes; 

    public MyObject() {} 

    public String getName() { return name; } 
    public Map<String, String> getAttributes() { return attributes; } 
} 

從字正腔圓的實例JSON的樣子:

{ 
    "name" : "John Doe", 
    "attributes" : [{ 
    "..." : ... 
    },{ 
    }] 
} 

我期望實例JSON的樣子:

{ 
    "name" : "John Doe", 
    "attributes" : { 
    "..." : ..., 
    } 
} 

GenerateExampleJsonMethod在看到一個Map時總是創建一個ArrayNode。有沒有辦法獲得預期的JSON?

我正在使用說明版本1.26.2

回答

0

是的。這一點在1.27中得到了修正,本週有待釋放。