Aggregate JSON data together
Project description
Bus - Python Json Aggregator
Pre-Alpha project
Takes json payloads and combines them by nesting one in the payload of another using a shared key.
Installation
Install with Pip:
pip install bus
Usage
from bussing.busses import Bus
Bus().group(parent='PARENT JSON', child='CHILD JSON', keys=[("id", "shapes")]
Keys needs to be a list of tuples. The first element is the key ID to match results with, and the second is the new name to list items as under the parent.
Examples
Given:
[
{
"id":"Apples",
"colours":[
"Red",
"Green"
]
},
{
"id":"Bananas",
"colours":[
"Yellow"
]
},
{
"id":"Mangos",
"colours":[
"Orange",
"Green"
]
}
]
And:
[
{
"id":"Apples",
"round":true
},
{
"id":"Bananas",
"round":false
}
]
You can combine these results into one payload:
[
{
"id":"Apples",
"colours":[
"Red",
"Green"
],
"shapes":{
"round":true
}
},
{
"id":"Bananas",
"colours":[
"Yellow"
],
"shapes":{
"round":false
}
},
{
"id":"Mangos",
"colours":[
"Orange",
"Green"
]
}
]
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
bus-0.0.1.tar.gz
(2.1 kB
view hashes)
Built Distribution
bus-0.0.1-py3-none-any.whl
(14.7 kB
view hashes)