No commit activity in last 3 years
No release in over 3 years
This gem will help to to deserialize and consume data from a jsonapi. https://github.com/Sonberg/jsonapi-unwrapper
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

jsonapi-unwrapper

Gem Version Coverage Status

Dead simple parser / deserializer for json api (https://jsonapi.org/)

Install

gem 'jsonapi-unwrapper', '~> 0.0.1'

or

gem install jsonapi-unwrapper

Having issues?

Please let me know and create a issue

Use

require "jsonapi-unwrapper"

json = {
      "data" => {
        "id" => 1,
        "type" => "users",
        "attributes" => { "name" => "Joe" },
        "relationships" => {
          "pet" => {
            "data" => { "id" => 1, "type" => "pets" },
          },
        },
      },
      "included" => [
        {
          "id" => 1,
          "type" => "pets",
          "attributes" => {
            "type" => "turtle",
            "name" => "Josef",
          },
        },
      ],
    }

    parsed = JsonApiUnwrapper.call(json)

    parsed["id"] // 1
    parsed["name"] // Joe
    parsed["pet"]["name"] // Frank

Feel free to create a pull request