JSON API to document parser
Project description
JSON API to document parser. Available as a command line utility and Python 3 module.
This parser will transform JSON API (http://jsonapi.org/) documents to object easier to manipulate.
For this JSON API document:
{
"data": [{
"type": "articles",
"id": "1",
"attributes": {
"title": "JSON API paints my bikeshed!",
"body": "The shortest article. Ever.",
"created": "2015-05-22T14:56:29.000Z",
"updated": "2015-05-22T14:56:28.000Z"
},
"relationships": {
"author": {
"data": {"id": "42", "type": "people"}
}
}
}],
"included": [
{
"type": "people",
"id": "42",
"attributes": {
"name": "John",
"age": 80,
"gender": "male"
}
}
]
}
The simplified version will be:
[
{
"type": "articles",
"id": "1",
"title": "JSON API paints my bikeshed!",
"body": "The shortest article. Ever.",
"created": "2015-05-22T14:56:29.000Z",
"updated": "2015-05-22T14:56:28.000Z",
"author": {
"type": "people",
"id": "42",
"name": "John",
"age": 80,
"gender": "male"
}
}
]
Usage as python module
import json_api_doc
document = {
'data': {
'type': 'article,
'id': '1',
'attributes': {
'name': 'Article 1'
}
}
}
json_api_doc.parse(document)
Usage as cli
$ jsonapidoc document.json
Licence
Free software: Apache Software License 2.0
Documentation
Full Documentation is available: https://json-api-doc.readthedocs.io.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
json-api-doc-0.1.0.tar.gz
(3.6 kB
view hashes)
Built Distribution
Close
Hashes for json_api_doc-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0550328c91b86f5bddd6295b375ec5dc36f37bfe1f3eeffa43ff2b09eba6cde6 |
|
MD5 | fc2f70e934f156c48d7ab0f4b0680608 |
|
BLAKE2b-256 | fe247e0f0602dc1209af785a7d1940dcff665d9fef4429a6965e46610c91680a |