1

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

根据 ember 指南,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"
    }
}

如何以 ember 期望的形式格式化“licenceFeatures”数组?

4

0 回答 0