2013-03-07 54 views
0

我想用jQPlot與Struts的,我從像Struts動作JSON結果輸出:struts2的json的正則表達式

{ 
    "jqPlotJSONFormat": 
     "['18-03-2010',56],['19-03-2010',43],['17-03-2010',84]" 
} 

,但我想要得到的數據,如:

['18-03-2010', 56], 
['19-03-2010', 43], 
['17-03-2010', 84] 

這是我的動作映射:

@Action(value="getData", results = { 
    @Result(name="success",type = "json", params = { 
    "includeProperties","jqPlotJSONFormat" 
})}) 

我想隱藏在JSON結果

的jqPlotJSONFormat

回答

1

Set the root object to be the jqPlotJSONFormat,大致(XML版本):

<result type="json"> 
    <param name="root"> 
    jqPlotJSONFormat 
    </param> 
</result> 

而不是在你的PARAMS 「includeProperties」,用 「根」。這聲明瞭JSON對象的根。使用「includeProperties」,動作仍然是根(例如,屬性將被命名)。

+0

+1更具體地說,在OP的情況下,將params改爲:「root」,「jqPlotJSONFormat」 – Quaternion 2013-03-08 00:24:18

相關問題