jsonapi helperJSONAPI链接属性的转换与嵌入
jsonapi-helper该项目提供了一个简单的辅助规范,该规范只是一个顶级转换的响应JSON linked属性,以嵌入对象形式回应JSON没有linked属性。展开收集说,如果你的响应是一个由这样的主键键控的集合:
var posts = {
\"posts\": [
{
\"id\": \"1\",
\"title\": \"Post Title 1\",
\"links\": {
\"author\": \"9\",
\"comments\": [\"1\", \"2\", \"3\"]
}
},
{
\"id\": \"2\",
\"title\": \"Post Title 2\",
\"links\": {
\"author\": \"9\",
\"comments\": [\"4\"]
}
}
]
}
下载地址
用户评论