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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file bus-0.0.1.tar.gz.

File metadata

  • Download URL: bus-0.0.1.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for bus-0.0.1.tar.gz
Algorithm Hash digest
SHA256 b1da17df4173221897a1ff80763a2a9d4baa4aab381a05b9dfa34f9a735e32a2
MD5 52a772e736807e42c97780cde98b5b2b
BLAKE2b-256 40b6eb0cd2bb1919c2d8aa321b4ae72ea201de00ded606ff8dc1ff2a3ebb6a63

See more details on using hashes here.

File details

Details for the file bus-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: bus-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for bus-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ae189c220c0bc5d7862f7cbe540946e5cfcee3bb83acb2ad271eb58f76cd4c5c
MD5 12ad2c1ac1ea6f5f961c77b4ec0e0781
BLAKE2b-256 e2d663d135ca4219ce697cec3e218e0a4df43169bc4760ad6ff5a7615c549e2d

See more details on using hashes here.

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