| Name | Data Unflattener |
| Version | v1.0.0 |
| GitHub | weeve-modules/data-unflattener |
| Authors | Jakub Grzelak |
Restore your flattened data to its previous nested form. Use the following symbols for indicating parentness in your data labels, i.e. if parentness is / then data {'location/city': 'Berlin'} will be restored to {'location': {'city': 'Berlin'}}. If you expect your restored data to contain a list of JSON objects then select "Search for Lists" option. It will treat numbers in data labels as indicators of list indexing in the restored data, i.e. {'location/0/city': 'Berlin'} will be restored to {'location': [ {'city': 'Berlin'} ]} (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 data labels, i.e. if delimiter is / then data {'location/city': 'Berlin'} will be restored to {'location': {'city': 'Berlin'}}. |
| Search for Lists | SEARCH_FOR_LISTS | string | If true then numbers in data labels will indicate list indexing in the restored data, i.e. {'location/0/city': 'Berlin'} will be restored 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/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/email/1/address": "[email protected]",
"employees/1/email/1/type": "private",
"employees/1/age": 28,
"employees/2/name": "John",
"employees/2/email": "[email protected]",
"employees/2/age/year": 1990,
"employees/2/age/month": "January",
"employees/2/age/day": 1,
"employees/3/name": "Bob",
"employees/3/email": "[email protected]",
"employees/3/age": 41
}
[
{
"location/city": "Berlin",
"location/country": "Germany"
},
{
"device/name": "RaspberryPi",
"device/id": "dasc4d4a"
}
]
If DELIMITER = / and SEARCH_FOR_LISTS = True then output of 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"
},
{
"address": "[email protected]",
"type": "private"
}
],
"age": 28
},
{
"name": "John",
"email": "[email protected]",
"age": {
"year": 1990,
"month": "January",
"day": 1
}
},
{
"name": "Bob",
"email": "[email protected]",
"age": 41
}
]
}
[
{
"location": {
"city": "Berlin",
"country": "Germany"
}
},
{
"device": {
"name": "RaspberryPi",
"id": "dasc4d4a"
}
}
]
Content type
Image
Digest
sha256:d2d22e58d…
Size
48.4 MB
Last updated
over 3 years ago
docker pull weevenetwork/data-unflattener:v1.0.1