{"id":25471114,"url":"https://github.com/trainline/json-api-vanilla","last_synced_at":"2025-11-05T01:30:22.408Z","repository":{"id":48405399,"uuid":"70801331","full_name":"trainline/json-api-vanilla","owner":"trainline","description":"Deserialize JSON API formats into vanilla Ruby objects.","archived":false,"fork":false,"pushed_at":"2021-07-27T19:26:24.000Z","size":35,"stargazers_count":39,"open_issues_count":6,"forks_count":21,"subscribers_count":4,"default_branch":"master","last_synced_at":"2023-03-08T22:44:37.660Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trainline.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-13T11:50:58.000Z","updated_at":"2022-05-28T11:24:34.000Z","dependencies_parsed_at":"2022-08-24T09:32:19.607Z","dependency_job_id":null,"html_url":"https://github.com/trainline/json-api-vanilla","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trainline%2Fjson-api-vanilla","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trainline%2Fjson-api-vanilla/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trainline%2Fjson-api-vanilla/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trainline%2Fjson-api-vanilla/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trainline","download_url":"https://codeload.github.com/trainline/json-api-vanilla/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239447469,"owners_count":19640306,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-18T09:36:33.184Z","updated_at":"2025-11-05T01:30:22.367Z","avatar_url":"https://github.com/trainline.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSON API *VANILLA*\n\nDeserialize JSON API formats into *vanilla* Ruby objects.\nThe simplest JSON API library at all altitudes above Earth centre.\n\n```ruby\n# gem install json-api-vanilla\nrequire \"json-api-vanilla\"\njson = IO.read(\"articles.json\")  # From http://jsonapi.org\ndoc = JSON::Api::Vanilla.parse(json)\ndoc.data[0].comments[1].author.last_name  # \"Gebhardt\"\n```\n\nCompare with [jsonapi](https://github.com/beauby/jsonapi):\n\n```ruby\n# gem install jsonapi --pre\nrequire \"jsonapi\"\njson = IO.read(\"articles.json\")\ndoc = JSONAPI.parse(json)\ncomment_ref = doc.data[0].relationships.comments.data[1]\ncomment = doc.included.select do |obj|\n  obj.type == comment_ref.type \u0026\u0026 obj.id == comment_ref.id\nend[0]\nauthor_ref = comment.relationships.author.data\nauthor = doc.included.select do |obj|\n  obj.type == author_ref.type \u0026\u0026 obj.id == author_ref.id\nend[0]\nauthor.attributes['last-name']\n```\n\n# Documentation\n\n`JSON::Api::Vanilla.parse(json_string)` returns a document with the following\nfields:\n\n- `data` is an object corresponding to the JSON API's data object.\n- `errors` is an array containing [errors](http://jsonapi.org/format/#error-objects). Each error is a Hash.\n- `links` is a Hash from objects (obtained from `data`) to their links, as a\n  Hash.\n- `rel_links` is a Hash from objects' relationships (obtained from `data`) to\n  the links defined in that relationship, as a Hash.\n- `meta` is a Hash from objects to their meta information (a Hash).\n- `find('type', 'id')` returns the object with that type and that id.\n- `find_all('type')` returns an Array of all objects with that type.\n- `keys` is a Hash from objects to a Hash from their original field names\n  (non-snake\\_case'd) to the corresponding object.\n\n# License\n\nCopyright © Trainline.com Limited. All rights reserved. See LICENSE.txt in the project root for license information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrainline%2Fjson-api-vanilla","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrainline%2Fjson-api-vanilla","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrainline%2Fjson-api-vanilla/lists"}