Skip to main content

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


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)

Uploaded Source

Built Distribution

bus-0.0.1-py3-none-any.whl (14.7 kB view hashes)

Uploaded 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