JA2R
JASON-API to Ruby Object
Converts a JSON-API payload into a ruby object which supports navigation over relationships.
Usage
json = <<-JSON
{
"data":{
"id":"1001",
"type":"persons",
"attributes":{
"name":"Bart"
},
"relationships":{
"sister":{
"data":{
"id":"1002",
"type":"persons"
}
}
}
},
"included":[
{
"id":"1002",
"type":"persons",
"attributes":{
"name":"Lisa"
}
}
]
}
JSON
= JA2R.parse(JSON.parse(json))
.sister.name # Lisa