I'm beginning work with a server API that renders its' responses using the JSON:API (JSON:API — Latest Specification (v1.0)) syntax.
Is there any literature/documentation anywhere on using Codable with JSON:API? Been searching a lot (tough thing to Google for) but have not found anything.
It seems to me that the structure of Codable is not, at all, designed to work with such an object. (For example, coding into a specific object based on the type field, handling relationships with keys defining the class of the relationship).
But, as far as JSON:API is the closest thing to a JSON standard out there, Codable should handle it?
{
"data": [
{
"id": "104729",
"type": "address",
"attributes": {
"id": 104729,
"city": "Sunnydale",
"lat": "33.860736",
"lng": "-77.094892",
"state": "VA",
"street_1": "3627 Columbia Ave",
"street_2": "",
"zip": "22031"
},
"relationships": {
"user": {
"data": {
"id": "1",
"type": "user"
}
},
"zone": {
"data": {
"id": "109",
"type": "zone"
}
}
}
},
{
"id": "104535",
"type": "address",
"attributes": {
"id": 104535,
"city": "Sunnydale",
"lat": "33.863043",
"lng": "-77.096668",
"state": "VA",
"street_1": "809 S Hollywood St",
"street_2": "",
"zip": "22031"
},
"relationships": {
"user": {
"data": {
"id": "1",
"type": "user"
}
},
"zone": {
"data": {
"id": "109",
"type": "zone"
}
}
}
}
],
"included": [
{
"id": "109",
"type": "zone",
"attributes": {
"id": 109,
"name": "Hellmouth",
"active": true,
"additional_services": [
"delivery",
"pickup",
]
},
"relationships": {
"region": {
"data": {
"id": "3",
"type": "region"
}
}
}
}
]
}