Deserialize JSON API formats into vanilla Ruby objects.
Ruby Makefile
Switch branches/tags
Nothing to show
Clone or download
Latest commit 203692a Nov 23, 2017


Deserialize JSON API formats into vanilla Ruby objects. The simplest JSON API library at all altitudes above Earth centre.

# gem install json-api-vanilla
require "json-api-vanilla"
json ="articles.json")  # From
doc = JSON::Api::Vanilla.parse(json)[0].comments[1].author.last_name  # "Gebhardt"

Compare with jsonapi:

# gem install jsonapi --pre
require "jsonapi"
json ="articles.json")
doc = JSONAPI.parse(json)
comment_ref =[0][1]
comment = do |obj|
  obj.type == comment_ref.type && ==
author_ref =
author = do |obj|
  obj.type == author_ref.type && ==


JSON::Api::Vanilla.parse(json_string) returns a document with the following fields:

  • data is an object corresponding to the JSON API's data object.
  • errors is an array containing errors. Each error is a Hash.
  • links is a Hash from objects (obtained from data) to their links, as a Hash.
  • rel_links is a Hash from objects' relationships (obtained from data) to the links defined in that relationship, as a Hash.
  • meta is a Hash from objects to their meta information (a Hash).
  • find('type', 'id') returns the object with that type and that id.
  • find_all('type') returns an Array of all objects with that type.
  • keys is a Hash from objects to a Hash from their original field names (non-snake_case'd) to the corresponding object.


Copyright © Limited. All rights reserved. See LICENSE.txt in the project root for license information.