Pre-Alpha project
Takes json payloads and combines them by nesting one in the payload of another using a shared key.
Install with Pip:
pip install bus
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.
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"
]
}
]
- Releases: https://pypi.org/project/bus/
- Code: https://github.com/CoburnJoe/bus