| Name | Data Flattener |
| Version | v1.0.0 |
| GitHub | weeve-modules/data-flattener |
| Authors | Jakub Grzelak |
Flatten your nested data. Use the following symbols for indicating parentness in your nested data, i.e. if parentness is / then data {'location': {'city': 'Berlin'}} will be flattened to {'location/city': 'Berlin'}. If data contains a list of JSON objects then each object will be given a numeric index in the new label in the flattened output (see a list example in Output)
The following module configurations can be provided in a data service designer section on weeve platform:
| Name | Environment Variables | type | Description |
|---|---|---|---|
| Delimiter | DELIMITER | string | Symbol for indicating parentness delimiter in your nested data, i.e. if delimiter is / then data {'location': {'city': 'Berlin'}} will be flattened to {'location/city': 'Berlin'} |
Other features required for establishing the inter-container communication between modules in a data service are set by weeve agent.
| Environment Variables | type | Description |
|---|---|---|
| MODULE_NAME | string | Name of the module |
| MODULE_TYPE | string | Type of the module (Input, Processing, Output) |
| EGRESS_URLS | string | HTTP ReST endpoints for the next module |
| INGRESS_HOST | string | Host to which data will be received |
| INGRESS_PORT | string | Port to which data will be received |
bottle
requests
Input to this module is:
{
"employees": [
{
"name": {
"first-name": "Ram",
"family-name": "Blue"
},
"email": "[email protected]",
"age": 23
},
{
"name": {
"first-name": "Shyam",
"family-name": "Red"
},
"email": [
{
"address": "[email protected]",
"type": "business"
}
],
"age": 28
}
]
}
[
{
"location": {
"city": "Berlin",
"country": "Germany"
}
},
{
"device": {
"name": "RaspberryPi",
"id": "dasc4d4a"
}
}
]
If DELIMITER = / then output of this module is:
{
"employees/0/name/first-name": "Ram",
"employees/0/name/family-name": "Blue",
"employees/0/email": "[email protected]",
"employees/0/age": 23,
"employees/1/name/first-name": "Shyam",
"employees/1/name/family-name": "Red",
"employees/1/email/0/address": "[email protected]",
"employees/1/email/0/type": "business",
"employees/1/age": 28,
}
[
{
"location/city": "Berlin",
"location/country": "Germany"
},
{
"device/name": "RaspberryPi",
"device/id": "dasc4d4a"
}
]
Content type
Image
Digest
sha256:507ba072e…
Size
48.4 MB
Last updated
over 3 years ago
docker pull weevenetwork/data-flattener:v1.0.1