如何为emberjs格式化FlexJSON

时间:2014-03-28 12:00:35

标签: ember.js flexjson

嗨,我对FlexJson和emberjs都很陌生。

根据余烬指南,ember需要json采用以下格式:

{
  "post": {
      "comments": [1, 2, 3]
  }
}

我将以下内容用于特定型号:

public static JSONSerializer licence = new JSONSerializer()
    .exclude("class")
    .exclude("persistent")
    .exclude("entityId")
    .rootName("licence")
    .include("licenceFeatures.id")
    .exclude("licenceFeatures.*");

我得到以下输出:

{
    "licence": {
        "id": 1,
        "licenceDescription": "GPL is the most widely used free software license and has a strong copyleft requirement. When distributing derived works, the source code of the work must be made available under the same license.",
        "licenceFeatures": [
            {
                "id": 15
            },
            {
                "id": 3
            }
        ],
        "licenceName": "GNU General Public License (GPL) 2.0",
        "licenceURL": "http://opensource.org/licenses/GPL-2.0"
    }
}

如何格式化" licenceFeatures" ember期望形式的数组?

0 个答案:

没有答案