Skip to main content

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

Project description

JSON:API ORM

https://img.shields.io/pypi/v/jsonapi_orm.svg https://img.shields.io/travis/mislavcimpersak/jsonapi_orm.svg 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('http://jsonapiplayground.reyesoft.com/v2/authors')
obj = response_to_obj(r.json())

print('LIST OF ITEMS:')
for item in obj.data:
    print(item.name)


# single item
r = requests.get('http://jsonapiplayground.reyesoft.com/v2/authors/1')
obj = response_to_obj(r.json())

print('SINGLE ITEM')
print(obj.data.name)

History

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.

Source Distribution

jsonapi-orm-0.1.2.tar.gz (15.0 kB view hashes)

Uploaded Source

Built Distribution

jsonapi_orm-0.1.2-py2.py3-none-any.whl (3.6 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page