Skip to main content

Quick and dirty ORM that maps JSON:API responses to object attributes.

Project description

JSON:API ORM CircleCI Coveralls github Documentation Status

Quick and dirty ORM that maps JSON:API responses to object attributes.

How To

Use Requests or (if you are a masochist) Python’s built-in urllib modules to make the request to your JSON:API service and from there pass the response to JSON:API ORM.

So, first install requests and this lib:

pip install requests
pip install jsonapi-orm

Switch to your Python code and use the magic!

import requests
from jsonapi_orm import response_to_obj

# list of items
r = requests.get('')
obj = response_to_obj(r.json())

print('LIST OF ITEMS:')
for item in
    # author is defined as a relationship

# single item
r = requests.get('')
obj = response_to_obj(r.json())

print('SINGLE ITEM')
# author is defined as a relationship


  • Since Python object attribute names have certain rules like not starting with a number or not containing “-” char, all such attributes can be accessed using .get() method. Ie.'first-name').
  • If relationship is not described in more detail in the included part of the response matching fails silently.
  • For now, this lib does not lazily follow relationship links or anything like that. You can of course make a new request to the given link and pass that response to JSON:API ORM.
  • For now, there is no check if response is a valid JSON:API response. But you’ll probably get that you are trying to parse an invalid response when things start to break.
  • And last, this lib requires Python 3.5 or newer.


0.1.8 (2018-04-06)

  • Added test config and basic tests.

0.1.7 (2018-03-25)

  • Using readme.rst for frontpage of the docs.

0.1.7 (2018-03-25)

  • Fixed pip install.

0.1.6 (2018-03-25)

  • Readme fix for pypi.

0.1.5 (2018-03-25)

  • Readme fix for pypi.

0.1.4 (2018-03-25)

  • Readme examples using slighty modified examples from which are located in this repo.

0.1.3 (2018-03-25)

  • Fixed a bug when child data is non-existent.

0.1.2 (2018-03-25)

  • Fixed a bug when included is not present in response.

0.1.0 (2018-03-24)

  • First release on PyPI.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for jsonapi-orm, version 0.1.8
Filename, size File type Python version Upload date Hashes
Filename, size jsonapi_orm-0.1.8-py3-none-any.whl (7.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size jsonapi-orm-0.1.8.tar.gz (18.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page