看来双方都有牵绊。
有利于根元素
根据 JSONAPI.org
它的根密钥必须与服务器对集合的 GET 请求的响应中提供的根密钥相同。
例如,假设以下请求收集照片:
GET /photos
HTTP/1.1 200 OK
Content-Type: application/json
{
"photos": [{
"id": "1",
"title": "Mustaches on a Stick"
}]
}
赞成无根元素
Twitter 在使用设置对象时不会
{
"always_use_https": true,
"discoverable_by_email": true,
"geo_enabled": true,
"language": "en",
"protected": false,
"screen_name": "theSeanCook",
"show_all_inline_media": false,
"sleep_time": {
"enabled": false,
"end_time": null,
"start_time": null
},
"time_zone": {
"name": "Pacific Time (US & Canada)",
"tzinfo_name": "America/Los_Angeles",
"utc_offset": -28800
},
"trend_location": [
{
"country": "United States",
"countryCode": "US",
"name": "Atlanta",
"parentid": 23424977,
"placeType": {
"code": 7,
"name": "Town"
},
"url": "http://where.yahooapis.com/v1/place/2357024",
"woeid": 2357024
}
],
"use_cookie_personalization": true
}
Instagram 使用数据和元数据的组合,但不使用根用户对象
{
"meta": {
"code": 200
},
"data": {
"username": "obama",
"bio": "",
"website": "",
"profile_picture": "http://images.ak.instagram.com/profiles/anonymousUser.jpg",
"full_name": "",
"counts": {
"media": 30,
"followed_by": 113,
"follows": 130
},
"id": "2082346"
}
}